Feature articles on home page

Discussion about MagicEdit features, modules, applications, and HowTos.

Feature articles on home page

Postby abeeha » Thu Aug 15, 2013 2:54 am

Hello,

My website has numerous articles but I would like to only feature a few of those articles on the home page. Is there a button or something that I can make with magic edit that will push articles to the home page. Right now I have 3 articles on the home page that are also featured elsewhere on the site. I would like to be able to show any 3 selected articles from the rest of the site on the homepage without having to hard-code those articles into the home page. - - I hope that makes sense.
ABEEHA
abeeha
 
Posts: 1
Joined: Thu Aug 15, 2013 2:50 am

Re: Feature articles on home page

Postby vitaliy » Wed Aug 21, 2013 2:08 pm

If you want to manually determine which article should show on the home page you can use cl_visible method.
Here is an example.

My article repeat html example:
Code: Select all
<ul>
<magicrepeat me_repeat="articleRepeat">
<li><h2>Article Title</h2>
<p>Article summary text</p>
<div cl_visible="=CLManager.activeAccount:isAdmin"><magicedit me_name="showOnTheHomePage" me_plain>Edit this text to show the article</magicedit></div>
</li>
</magicrepeat>
</ul>


My Home page article repeat example:
Code: Select all
<ul>
<magicrepeat me_repeat="articleRepeat">
<li cl_visible="=$showOnTheHomePage"><h2>Article Title</h2>
<p>Article summary text</p>
</li>
</magicrepeat>
</ul>

In this case only the articles that have the me_name="showOnTheHomePage" region edited will show up on the home page. Using this method you would have to manually edit the region on the articles you what to show.
You can read more on cl_visible in documentation. http://www.magicedit.com/ShowingandHidingStuf.cl


If you don't want manual control you can also use me_maxitems attribute on the repeat on the home page.

me_maxitems home page article repeat example:
Code: Select all
<ul>
<magicrepeat me_repeat="articleRepeat" cl_sort="-created" me_maxitems="3">
<li><h2>Article Title</h2>
<p>Article summary text</p>
</li>
</magicrepeat>
</ul>

This will only show you the top 3 most recent articles in the repeat. This is the easiest method. Find docs here. http://www.magicedit.com/MagicRepeatTags.cl

Hope it help.

Let me know if you have any more questions.
vitaliy
 
Posts: 9
Joined: Tue Apr 12, 2011 3:30 pm


Return to MagicEdit Discusson

Who is online

Users browsing this forum: No registered users and 1 guest

cron