Page 1 of 1
Show content of a single page in a div of the template
Posted: Thu Nov 01, 2012 3:17 pm
by jbveenstra
In my website I want to have some user editable parts.
E.g. a header, or some standard text.
The user can edit a page or article's content to update the part in the website.
Below is the code of the main content. Very basic.
Code: Select all
<div id="content">
<h2>{title}</h2>
<p>{content}</p>
</div>
What smarty tag code do I use to show only the content of one specific article or a news item?
I use the latest version of CMSMS
Re: Show content of a single page in a div of the template
Posted: Thu Nov 01, 2012 3:32 pm
by uniqu3
You can use content blocks.
Code: Select all
{content block='my_block' name='My nice additional content block'}
In "Extensions -> Tags -> {content}" or here
http://docs.cmsmadesimple.org/tags/core/content you can read more about options for this tag.
To show a specific article from news module you could do something like below, where you would have input field while editing a content page and entering a News article ID number in that field:
Code: Select all
{content block='news_article' label='Enter Article ID to show' oneline='true' size='5' assign='show_article'}
{if !empty($show_article)}
{news action='detail' articleid=$show_article}
{/if}
There are other ways to do tasks like this as well, depends on what you are actually trying to achieve.
Re: Show content of a single page in a div of the template
Posted: Thu Nov 01, 2012 9:02 pm
by jbveenstra
Ok, I tried your approach, but unfortunately it does'nt seem to work.
No doubt I missed something here

So, this is what I did:
In the code of my template I placed this div
Code: Select all
<div id="footer">
<p>{content block="Footer Article" label="Footer Article"}</p></div>
In the backend I've made a new page called Footer Article
Menutext is also Footer Article and I named the block Footer Article
In the options: Show in menu = no
Nothing is visible. In the source code only <p> </p> is showing
Re: Show content of a single page in a div of the template
Posted: Thu Nov 01, 2012 9:26 pm
by Rolf