Show content of a single page in a div of the template

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
jbveenstra
New Member
New Member
Posts: 2
Joined: Wed Oct 31, 2012 7:43 pm

Show content of a single page in a div of the template

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

Re: Show content of a single page in a div of the template

Post 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.
jbveenstra
New Member
New Member
Posts: 2
Joined: Wed Oct 31, 2012 7:43 pm

Re: Show content of a single page in a div of the template

Post 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
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Show content of a single page in a div of the template

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “Layout and Design (CSS & HTML)”