teaser template: new {ARTICLEID} tag

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
User avatar
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London

teaser template: new {ARTICLEID} tag

Post by pSouper » Sun 7. Oct 2007, 19:38

hi All, possibly the smallest hack so far, only a copied line with the slighted alteration allows you to get and use the target article ID for a teaser article.

I have a teaser template that uses {RANDOM/picture/{ARTICLEID}} to display a random image in a teaser that is randomly selected from a sub folder of ./picture of the same name as the article ID.

e.g. a teaser of the article 47 would use a randomly selected imag from the folder picture/47/ by using this tag... {RANDOM/picture/47} in the teaser's template file.

maybe one of the least required hack too but I hope it helps someone add a neat trick to their site.

EDIT: oops forgot to add the hack :oops:

opend file...
find line:

Code: Select all

$content['alink']['tr'][$key]	= str_replace('{ARTICLELINK}', 'index.php?aid='.$row['article_id'], $content['alink']['tr'][$key]);
after, add...

Code: Select all

					$content['alink']['tr'][$key]	= str_replace('{ARTICLEID}', $row['article_id'], $content['alink']['tr'][$key]);//HACK:pSouper add {ARTICLEID replacement tag to display the articleID}
usage: place {ARTICLEID} within any teaser template.

note: this tag is only add to the functionality of the 'teaser' content part

this tag can be viewed in action as the big (random) teaser image on the homepage here... http://www.teensunitefightingcancer.org/index.php (site under construction)
Last edited by pSouper on Sun 7. Oct 2007, 21:28, edited 4 times in total.

User avatar
Posts: 6395
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update » Sun 7. Oct 2007, 20:05

...one of the least required hack too...
Now I know about it I require it :lol: very lovely possibility.. :!:

Posts: 5
Joined: Tue 7. Dec 2010, 12:23

Re: teaser template: new {ARTICLEID} tag

Post by maarten@prokas » Tue 7. Dec 2010, 12:58

can you add a navigational link in it aswell? and i have three picture pools from wich a want to select pictures circuit, rally and parts. does this mean three dirs in the picturedir from wich pictures are chosen?
grx maarten

Post Reply