[Solved] Modifying {$entry->morelink}

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
Aureli
Forum Members
Forum Members
Posts: 74
Joined: Wed Aug 06, 2008 10:48 pm

[Solved] Modifying {$entry->morelink}

Post 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:

Code: Select all

<a href="http:myNews">More</a>
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.
Last edited by Aureli on Sun Jul 19, 2015 10:24 pm, edited 1 time in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Modifying {$entry->morelink}

Post 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>
Aureli
Forum Members
Forum Members
Posts: 74
Joined: Wed Aug 06, 2008 10:48 pm

Re: Modifying {$entry->morelink}

Post by Aureli »

Thanks for this, I am working this weekend so I'll have a look at it on Monday
Aureli
Forum Members
Forum Members
Posts: 74
Joined: Wed Aug 06, 2008 10:48 pm

Re: Modifying {$entry->morelink}

Post 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
Post Reply

Return to “The Lounge”