Page 1 of 1

teaser template: new {ARTICLEID} tag

Posted: Sun 7. Oct 2007, 19:38
by pSouper
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.

WHY?
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...
include/inc_front/content/cnt8.article.inc.php
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)

Posted: Sun 7. Oct 2007, 20:05
by update
...one of the least required hack too...
Now I know about it I require it :lol: very lovely possibility.. :!:

Re: teaser template: new {ARTICLEID} tag

Posted: Tue 7. Dec 2010, 12:58
by maarten@prokas
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