Dynamically generated article preview

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
User avatar
web2net
Posts: 10
Joined: Mon 22. Jun 2009, 09:59
Location: South Tyrol, Italy

Dynamically generated article preview

Post by web2net »

Dear phpwcms support team,

It's quite a long time that we're using phpwcms for our dynamic websites - mostly to our complete satisfaction :)

Now my question is the following:

On the website http://www.bergland.it I have a complete multi-category menu generated dynamically with the {NAV_TABLE_COLUMN} replacement-tag.
No worries so far.

Now, what I need is a dynamically generated preview (article image, title and subtitle) of every article in a given category, like on this page: http://www.bergland.it/cms/index.php?madonnas_8a1 (here it is created manually). Hence if an article is added to a category, the article preview page should display it as well.

What I was wondering is: Is there a (more or less comfortable) way of extracting all the articles of a given category from the database to print them on my preview site?
Or did I miss the relative content part or replacement tag?
Or is there maybe an easier way of implementing this?

Thanks in advance for any suggestions,
Tobias
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Dynamically generated article preview

Post by flip-flop »

Hello,

I think there is an easy way to solve your problem. Have a look into the CP "teaser/link article".
Using this CP you can create your own CP templates.

Have a closer look to the difference of the selector "manual (arrow up/down) and "all other".

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
web2net
Posts: 10
Joined: Mon 22. Jun 2009, 09:59
Location: South Tyrol, Italy

Re: Dynamically generated article preview

Post by web2net »

hi, thanks for your quick reply :)
I'll take a look to that content parts, and let you know.
User avatar
web2net
Posts: 10
Joined: Mon 22. Jun 2009, 09:59
Location: South Tyrol, Italy

Re: Dynamically generated article preview

Post by web2net »

Ok, i took a closer look to the Teaser/Articlelink CP.

It seems to be exactly what I need, except for the fact that it does NOT include every article's content part(s).
Now that's a problem for me, because my article's images are not embedded in the article as normal images, they are attached as image content part.

And I need the images in my teaser.

Maybe it is possible to link the relative article's content part in the template?
Is there any replacement tag for an article's content part?

Thanks again,
Tobias
User avatar
Oliver Georgi
Site Admin
Posts: 9909
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: Dynamically generated article preview

Post by Oliver Georgi »

Try replacement tag:
{SHOW_CONTENT:MODE,id[,id[,...]]}

MODE options:
  • CP - list of Content Parts | id = id of the content part, one or more possible, comma seperated.
  • CPA - ascending list of Content Parts but based on selected article | id = id of article, comma seperated
  • CPAD - same as CPA, but descending
  • AS - list of Article Summaries | id = id of articles, comma separated
  • CAS - list of Article Summaries | id = id of structure level, comma separated
For you need Mode CPA and article ID (that hold the content parts)

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
web2net
Posts: 10
Joined: Mon 22. Jun 2009, 09:59
Location: South Tyrol, Italy

Re: Dynamically generated article preview

Post by web2net »

Ok, this is basically exactly what I need, but there is still a Problem:

How can I access the article ID in the teaser template?
Something like a replacement tag for the article ID would be incredibly helpful!

cheers meanwhile,
Tobias
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Dynamically generated article preview

Post by flip-flop »

I don´t know exactly your structure but if you wan´t to use the show_content tag in teaser, there is only one way to do so.

We need the ID of the article listed in each case. (You have written it before).
It isn´t implemented at this time:

Patch:
\include\inc_front\content\cnt8.article.inc.php

around line 395 insert:

Code: Select all

     // article id
     $content['alink']['tr'][$key] = str_replace('{ARTICLEID}', $row["article_id"], $content['alink']['tr'][$key]);
And in your teaser template insert

Code: Select all

[PHP]    echo showSelectedContent('CPA,{ARTICLEID}');[/PHP]
Thats a very dirty solution, but for this moment I can´t see an other one.

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Dynamically generated article preview

Post by flip-flop »

Without teaser:

An other solution without a hack: http://forum.phpwcms.org/viewtopic.php?p=109060#p109060

Or have a direct call of Show_Content in your Template (Vorlage)

Code: Select all

[PHP]    echo showSelectedContent('CPA,'.$GLOBALS['aktion'][1]);[/PHP]
$GLOBALS['aktion'][1] is the actual article id. -> Systemvariablen

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Dynamically generated article preview

Post by flip-flop »

All you need is implemented in the newest version V1.4.2 r316(317) -> http://code.google.com/p/phpwcms/source/list
New global replacement tags {CURRENT_ARTICLEID} and {CURRENT_CATEGORYID} can be
used for (partly) dynamic replacement tags like
{SHOW_CONTENT:CPA,{CURRENT_ARTICLEID}}
Content part Teaser enhanced by replacement tags {ARTICLEID} and {CATEGORYID}
for teaser items.
Thanks to O.G. for the implementation of this Tag. :!:

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Post Reply