Page 1 of 1

[Solved] Client decides the number of news teasers

Posted: Fri Aug 01, 2014 9:06 am
by Reclus
A client wishes to regularly change the number of news items/teasers shown on the home page.

Is there a way to enable them to do this, perhaps with a field where they can type a number?

Something like…

How many news items to you want to display?
[4]

Re: Client decides the number of news teasers on the homepag

Posted: Fri Aug 01, 2014 9:15 am
by paulbaker
Add a category called "Show on home page" and then adjust your module call to show only items in that category?

Re: Client decides the number of news teasers on the homepag

Posted: Fri Aug 01, 2014 9:52 am
by Jos
Reclus wrote:Is there a way to enable them to do this, perhaps with a field where they can type a number?
Check the module: Custom Global Settings

Re: Client decides the number of news teasers on the homepag

Posted: Fri Aug 01, 2014 10:56 am
by chandra
Add an additional content block as the first line to your page template

Code: Select all

 
{content block='newscounter' oneline=true wysiwyg=false label='Number of News' size='3' assign='newscounter'} 


After that modify your news module call like

Code: Select all

{if isset($newscounter) && ! empty($newscounter) && is_int($newscounter)} 
{News number=$newscounter}
{else} 
{News number='3'} 
{/if} 

Re: Client decides the number of news teasers on the homepag

Posted: Fri Aug 01, 2014 11:48 am
by Reclus
Thanks very much chandra, simple solution and works a treat!

Re: [Solved] Client decides the number of news teasers

Posted: Fri Aug 01, 2014 10:36 pm
by Rolf
You better add a check if the filled in value is a number and not text or something...

Re: [Solved] Client decides the number of news teasers

Posted: Sat Aug 02, 2014 6:29 am
by chandra
Nothing is easier like that - example modified ;).