include content from another page

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
reljicb

include content from another page

Post by reljicb »

Hi all,

I'd like to make a custom tag which includes content from another page than the current (loaded/requested) one.
In other words, something like {content}, but with an attribute which points to the "other" page alias or id (for example: {my_content page=%page-alias%}).

I'm new to CMSMS, I don't know which code should I use as basis (which interfaces/functions for DB access etc).

Any hint would be very appreciated. Thanks!

Bojan
alby

Re: include content from another page

Post by alby »

reljicb wrote: I'd like to make a custom tag which includes content from another page than the current (loaded/requested) one.
In other words, something like {content}, but with an attribute which points to the "other" page alias or id (for example: {my_content page=%page-alias%}).
Depends on what you want:
-- A simple alias (duplicate of another page): ContentAlias
-- A page but with only the content of another: CGSimpleSmarty

Look in forge

Alby
Last edited by alby on Mon Apr 21, 2008 9:49 am, edited 1 time in total.
reljicb

Re: include content from another page

Post by reljicb »

alby wrote: -- A page but with only the content of another: CGSimpleSmarty
Thank you Alby,

this is exactly what I was looking for:
  get_page_content($alias,[$block],[$assign]) - Returns the text of a specific content block of another page.

What I actually want is to make a custom tag which I would name "page teaser" tag (you know what I mean: "This article is about... [more]"), to show few lines of text from the given page and block.
Now, my original idea is to use an existing module/tag which fetch me the page content, and to leave first few lines, and the rest to truncate... To your knowledge, does this exist (I did tried to find it online, but unsuccessfully).

Cheers!
Bojan
Last edited by reljicb on Fri Apr 25, 2008 10:29 am, edited 1 time in total.
cubix
Power Poster
Power Poster
Posts: 314
Joined: Mon Jul 09, 2007 10:00 am

Re: include content from another page

Post by cubix »

the news module?
alby

Re: include content from another page

Post by alby »

reljicb wrote:   get_page_content($alias,[$block],[$assign]) - Returns the text of a specific content block of another page.

What I actually want is to make a custom tag which I would name "page teaser" tag (you know what I mean: "This article is about... [more]"), to show few lines of text from the given page and block.
Use get_page_content and truncate modifier of smarty

Alby
Post Reply

Return to “Developers Discussion”