phpwcms article replacement tags


/ Published in: PHP
Save to your folder(s)

{ARTICLE_TITLE} {ARTICLE_ID} {ARTICLE_ALIAS}
{TOPLEVEL}
{PAGETITLE} = {CATEGORY} (since v1.3.5 )
{CATEGORY_ID} {CATEGORY_ALIAS}

Filename: rt_cat_article_id.php
Folder: /template/inc_script/frontend_render/
Switch: $phpwcms['allow_ext_render'] = 1; (/config/phpwcms/conf.inc.php)


Copy this code and paste it in your HTML
  1. <?php
  2. /* ================================================================
  3. 14.10.2008 Tags assembled by (KH) flip-flop
  4.  
  5. TAG:
  6. {ARTICLE_TITLE} {ARTICLE_ID} {ARTICLE_ALIAS}
  7. {TOPLEVEL}
  8. {PAGETITLE}={CATEGORY} {CATEGORY_ID} {CATEGORY_ALIAS}
  9.  
  10. Filename: rt_cat_article_id.php
  11. Folder: /template/inc_script/frontend_render/
  12. Switch: $phpwcms['allow_ext_render'] = 1; (/config/phpwcms/conf.inc.php)
  13.  
  14. Forum: http://forum.phpwcms.org/viewtopic.php?p=110038#p110038
  15.   ================================================================ */
  16. // ----------------------------------------------------------------
  17. // obligate check for phpwcms constants
  18. if (!defined('PHPWCMS_ROOT')) {
  19. die("You Cannot Access This Script Directly, Have a Nice Day."); }
  20. // ----------------------------------------------------------------
  21.  
  22.  
  23.  
  24. // {ARTICLE_TITLE} -> ARTICLE_TITLE replacement
  25. // -----------------------------------------------------
  26. if( ! (strpos($content["all"],'{ARTICLE_TITLE}')===false)) {
  27. $content["all"] = str_replace('{ARTICLE_TITLE}', $GLOBALS['row']['article_title'], $content["all"]);
  28. }
  29.  
  30. // {ARTICLE_ID} -> ARTICLE_ID replacement
  31. // -----------------------------------------------------
  32. if( ! (strpos($content["all"],'{ARTICLE_ID}')===false)) {
  33. $content["all"] = str_replace('{ARTICLE_ID}', $GLOBALS['row']['article_id'], $content["all"]);
  34. }
  35.  
  36. // {ARTICLE_ALIAS} -> ARTICLE_ALIAS replacement
  37. // -----------------------------------------------------
  38. if( ! (strpos($content["all"],'{ARTICLE_ALIAS}')===false)) {
  39. $content["all"] = str_replace('{ARTICLE_ALIAS}', $GLOBALS['row']['article_alias'], $content["all"]);
  40. }
  41.  
  42.  
  43.  
  44.  
  45. // {TOPLEVEL} -> TOPLEVEL replacement
  46. // -----------------------------------------------------
  47. if( ! (strpos($content["all"],'{TOPLEVEL}')===false)) {
  48.  
  49. $cur_toplevel_name = '';
  50. $GLOBALS['nav_point_listing'] = get_breadcrumb($GLOBALS['content']["cat_id"], $GLOBALS['content']['struct']);
  51.  
  52. if(isset($GLOBALS['nav_point_listing']) && count($GLOBALS['nav_point_listing']) > 1) {
  53. reset($GLOBALS['nav_point_listing']);
  54. next($GLOBALS['nav_point_listing']);
  55. $cur_toplevel_name = html_specialchars($GLOBALS['content']['struct'][ intval(key($GLOBALS['nav_point_listing'])) ]['acat_name']);
  56. }
  57. $content['all'] = str_replace('{TOPLEVEL}', $cur_toplevel_name, $content['all']);
  58. }
  59.  
  60. // {PAGETITLE} -> PAGETITLE replacement
  61. // sinze V1.3.5 this tag is replaced default by {CATEGORY}
  62. // -----------------------------------------------------
  63. if( ! (strpos($content["all"],'{PAGETITLE}')===false)) {
  64. $content["all"] = str_replace('{PAGETITLE}', $content["struct"][$content["cat_id"]]
  65. ["acat_name"], $content["all"]);
  66. }
  67.  
  68. // {CATEGORY_ID} -> CATEGORY ID replacement
  69. // -----------------------------------------------------
  70. if( ! (strpos($content["all"],'{CATEGORY_ID}')===false)) {
  71. $content["all"] = str_replace('{CATEGORY_ID}', $GLOBALS['content']["struct"][$GLOBALS['content']["cat_id"]]["acat_id"], $content["all"]);
  72. }
  73.  
  74. // {CATEGORY_ALIAS} -> CATEGORY ALIAS replacement
  75. // -----------------------------------------------------
  76. if( ! (strpos($content["all"],'{CATEGORY_ALIAS}')===false)) {
  77. $content["all"] = str_replace('{CATEGORY_ALIAS}', $GLOBALS['content']["struct"][$GLOBALS['content']["cat_id"]]["acat_alias"], $content["all"]);
  78. }
  79.  
  80. // -----------[ CLOSE ]----------------
  81. ?>

URL: http://forum.phpwcms.org/viewtopic.php?f=8&t=17949

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.