{TEASER:alias} Replacement tag

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Plauderer
Posts: 26
Joined: Tue 3. Aug 2004, 13:26

Post by Plauderer »

One more thing: Please do not send me private messages within the forum. Instead post your qestions here. I'm getting informed of it and will answer to it. This way other people might benefit from your questions aswell. Thanks! :wink:
osku
Posts: 8
Joined: Tue 21. Jun 2005, 19:25
Location: Germany

Post by osku »

hi Plauderer

and thanx for your answer

but,
Plauderer wrote:The alias with which you reference it is the structure-points alias!
where do i get/set "structure-points alias" ?
(search for "structure-points alias" or "alias" on phpwcms-docu.de didnt return anything)

i have followed the instructions here:
--...--/index.php/topic,64.0.html

made my article templates as described in this thread at "Thu Sep 30, 2004 11:05" and used these on the article i want to "teaser" on the frontpage. (btw. the title of this article isnt shown in the news section anymore)

but as you said
Plauderer wrote:The phpwcms-version i wrote for was Release 1.1-RC4 22-06-2004. I haven't tested it on newer versions although some said it works just aswell
would be very nice if someone who has this working on 1.2.3-dev could do a tutorial on this subject (or doesnt this work with 1.2.3-dev?)

yeah, im a n00b :?
ps. i just wanna do this: http://www.phpwcms.de/forum/viewtopic.php?t=6694 (meanwhile i prefer it not get the newest article automaticly)
osku
Posts: 8
Joined: Tue 21. Jun 2005, 19:25
Location: Germany

Post by osku »

hmm,

am i the onlyone who wants to use teaser with phpwcms1.2.3-dev ?!

is there no "built-in" way to display title,date,summary of desired article ?

btw. i've read (dunno where) that phpwcms2.0 will have "news" content type, will that atleast have this feature ?

as i know (php+mysql), this task is "very" easy, i wonder why its not implemented...
well, instead of waiting for someone to help, ill start to (dirty)hack it my self... :roll:

cheers,
osku
osku
Posts: 8
Joined: Tue 21. Jun 2005, 19:25
Location: Germany

Post by osku »

FYI: quick dirty n00b hack :roll:

Code: Select all

<?php
function get_article_teaseme($article_id){
   $sql  = 'select article_title,article_subtitle,article_summary,article_cid from '.
    DB_PREPEND.'phpwcms_article where article_id = ' .$article_id;
   if($result = mysql_query($sql)) {
      $row  = mysql_fetch_row($result);
      $mylink = 'index.php?id='.$row[3].','.$article_id.',0,0,1,0';
      return '<div class="listEntry"><h1>'.$row[0].'</h1><h2>'.$row[1].
       '</h2><p class="topText">'.$row[2].
       '&nbsp;<a href="'.$mylink.'">Mehr...</a></p></div>';
      mysql_free_result($result);
   }
}
if( ! ( strpos($content["all"],'{TEASEME')===false ) ) {
   $content["all"] = preg_replace('/\{TEASEME:(.*?)\}/ie',
    'get_article_teaseme("$1");',$content["all"]);
}
?>
osku
Posts: 8
Joined: Tue 21. Jun 2005, 19:25
Location: Germany

Post by osku »

Post Reply