Page 1 of 1
[Solved] Modifying {$entry->morelink}
Posted: Fri Jul 17, 2015 1:39 am
by Aureli
Hi,
I hope this is the right place for this question.
In the News module, when I use {$entry->morelink}
it gives me the following HTML output:
I am using Bootstrap and I would like the output to be :
Code: Select all
<a class="btn btn-default" href="http:myNews" role="button">More</a>
so I can change that link to be a button.
Any ideas of how to add the class there?
Or any links to documentation would be welcome.
Thanks.
Re: Modifying {$entry->morelink}
Posted: Fri Jul 17, 2015 9:43 am
by velden
Change your summary template to something like:
Code: Select all
...
{foreach from=$items item=entry}
<!-- {$entry|print_r} -->
...
Next, refresh the news page and look at the page source. Now you'll find somewhere the printed comments:
Code: Select all
(
[author_id] => 1
[author] => John
[authorname] =>
[id] => 2
[title] => Article II
[content] => <div id="lipsum">
<p>....</p>
</div>
[summary] => <p>...</p>
[postdate] => 2015-04-19 13:58:34
[startdate] =>
[enddate] =>
[create_date] => 2015-04-19 13:59:26
[modified_date] => 2015-04-19 13:59:26
[category] => General
[fields] =>
[fieldsbyname] =>
[file_location] => http://www.example.com/cmsms1x/uploads/news/id2
[link] => http://www.example.com/cmsms1x/news/2/39/Article-II
[titlelink] => <a href="http://www.example.com/cmsms1x/news/2/39/Article-II">Article II</a>
[morelink] => <a href="http://www.example.com/cmsms1x/news/2/39/Article-II">More</a>
[moreurl] => http://www.example.com/cmsms1x/news/2/39/Article-II
)
1 -->
This is a way to find out what properties are available for a specific object.
Bottom line:
You can use something like
Code: Select all
<a class="btn btn-default" href="{$entry->moreurl}" role="button">More</a>
Re: Modifying {$entry->morelink}
Posted: Fri Jul 17, 2015 9:47 am
by Aureli
Thanks for this, I am working this weekend so I'll have a look at it on Monday
Re: Modifying {$entry->morelink}
Posted: Sun Jul 19, 2015 10:22 pm
by Aureli
Thanks, now it makes sense. It has been a while since last development with CMSMS and had forgoten about {$entry|print_r}.
I was using [morelink] instead of [moreurl] and ended up with a nested <a> tag.
Thanks for the help.
Aureli