Free Press Release Submission




MB Publishing Webmaster Resource ::
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin 


Creating Dynamic Titles With phpnuke

 
Post new topic   Reply to topic    MB Publishing Webmaster Resource Forum Index -> Php Nuke Version 6.5
View previous topic :: View next topic  
Author Message
Colocation
Site Admin
Site Admin


Joined: Jan 07, 2004
Posts: 404

PostPosted: Fri Jun 11, 2004 9:28 pm    Post subject: Creating Dynamic Titles With phpnuke Reply with quote

Here is the code for dynamic titles, this is in a file called dynamic_titles.php which sits in the includes folder.

Code:
// Web Links
if($name=="Web_Links"){
global $l_op,$cid,$lid;
$newpagetitle = "$name $item_delim $slogan";
    if($l_op=="viewlink") {
        $sql = "SELECT title, parentid FROM ".$prefix."_links_categories WHERE cid='$cid'";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $cat = $row[title];
        $parent = $row[parentid];
            if($parent=="0"){
                $newpagetitle = "$cat $item_delim $name";
            }
            else{
                $sql = "SELECT title FROM ".$prefix."_links_categories WHERE cid='$parent'";
                $result = $db->sql_query($sql);
                $row = $db->sql_fetchrow($result);
                $parent = $row[title];
                $newpagetitle = "$parent $item_delim $cat $item_delim $name ";
            }
    }
}


This present the title as: Web_Links - Site Slogan

How then can we convert this to read:

Title of Weblink - Site Slogan

I have tried varibales such as $title or $displaytitle

Do we need more code to extract the title first?
Back to top
View users profile Send private message Visit posters website Yahoo Messenger
Humpa
Site Admin
Site Admin


Joined: Feb 05, 2004
Posts: 23

PostPosted: Mon Jun 14, 2004 11:56 am    Post subject: Reply with quote

At the begining is this:

// Web Links
if($name=="Web_Links"){
global $l_op,$cid,$lid;
$newpagetitle = "$name $item_delim $slogan";


You don't need to add another variable, you need to get rid of one.
The variable $name contains Web_Links, but you want it to read Weblink
So, just replace $name with Weblink .. it is as simple as that.

// Web Links
if($name=="Web_Links"){
global $l_op,$cid,$lid;
$newpagetitle = "Weblink $item_delim $slogan";
Back to top
View users profile Send private message Visit posters website
Colocation
Site Admin
Site Admin


Joined: Jan 07, 2004
Posts: 404

PostPosted: Tue Jun 15, 2004 12:13 am    Post subject: Titles Pulled From Database Reply with quote

That's neat.

Now suppose each web link entry has a unique title... in the weblinks code itself modules/Web_Links/index.php it is defined as $displaytitle:

Code:
echo "<br>";
    OpenTable();
    echo "<center><P><font class=\"option\"><b>"._LINKPROFILE.": <h1><i>$displaytitle</i></h1></b></font><br>";
    linkinfomenu($lid, $ttitle);


How do we get this $displaytitle pulled from the database to work here:

Code:
// Web Links
if($name=="Web_Links"){
global $l_op,$cid,$lid;
$newpagetitle = "Weblink $item_delim $slogan";
Back to top
View users profile Send private message Visit posters website Yahoo Messenger
Humpa
Site Admin
Site Admin


Joined: Feb 05, 2004
Posts: 23

PostPosted: Wed Jun 16, 2004 12:43 am    Post subject: Reply with quote

There are many different pages that can be displayed for WebLinks.
To see them all, just look at all the different "cases" defined at the end of the modules/Web_Links/index.php

In your Web Links dynamic title code you only have a condition for when $l_op is "viewlink". That is just one "case" of what $l_op can be.
For a WebLinks page where a link is displayed, $l_op is going to be "viewlinkdetails".
So, I added a condition to your dynamic titles to take into accout for $l_op="viewlinkdetails"

You might find that you want to add in one or more contions for some other $l_op cases. Let me know.

Code:
// Web Links
if($name=="Web_Links"){
global $l_op,$cid,$lid;
$newpagetitle = "$name $item_delim $slogan";
    if($l_op=="viewlink") {
      $sql = "SELECT title, parentid FROM ".$prefix."_links_categories WHERE cid='$cid'";
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $cat = $row[title];
      $parent = $row[parentid];
      if($parent=="0"){
         $newpagetitle = "$cat $item_delim $name";
      }else {
         $sql = "SELECT title FROM ".$prefix."_links_categories WHERE cid='$parent'";
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $parent = $row[title];
         $newpagetitle = "$parent $item_delim $cat $item_delim $name ";
      }
   }elseif($l_op=="viewlinkdetails") {
      $sql = "SELECT title FROM ".$prefix."_links_links WHERE lid='$lid'";
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $link_title = $row[title];
      $newpagetitle = "$link_title $item_delim $slogan";
   }
}
Back to top
View users profile Send private message Visit posters website
Colocation
Site Admin
Site Admin


Joined: Jan 07, 2004
Posts: 404

PostPosted: Wed Jun 16, 2004 12:56 am    Post subject: Treats Reply with quote

Champion!
Back to top
View users profile Send private message Visit posters website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    MB Publishing Webmaster Resource Forum Index -> Php Nuke Version 6.5 All times are GMT + 1 Hour
Page 1 of 1

 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Home | News Feeds | Release Archive | Web Marketing | Weight Loss | Publish Your Links | Press Release Topics | Free Downloads | Press FAQs | AvantGO | Amazon Store
Webmaster Forums | Search Releases | Press Topics | Feedback | Submit Press Release | Webmaster Surveys | Recommend | Top | Account | PM | Prweb | Free Link Submission | Add Downloads | New Media | Audio School | TOS

The comments are property of their posters, all the rest 2004 - 2008 by MB
Audana Ltd
You can syndicate our news using the file backend.php
Web site engine's code is Copyright © 2003 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.878 Seconds. -