Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
micah
Hangin' Around



Joined: May 25, 2006
Posts: 40

PostPosted: Sat Apr 17, 2010 8:52 am Reply with quote

Hi,

I am trying to change the page title of the content module. What I would like to display instead of the module name "Content" is the title of the content page that I enter in for the content title.

I use phpnuke 8.0

I thought that I could change

$pagetitle = "- $module_name";

to

$pagetitle = "- $mytitle";

but that does now work. I know that I am missing something but any support would be wonderful.

Below is a patch of code from my content module

-----

function showpage($pid, $page=0) {
global $prefix, $db, $sitename, $admin, $module_name;
include("header.php");
OpenTable();
$pid = intval($pid);
$mypage = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE pid='$pid'"));
$myactive = intval($mypage['active']);
$mytitle = stripslashes(check_html($mypage['title'], "nohtml"));
$mysubtitle = stripslashes(check_html($mypage['subtitle'], "nohtml"));
$mypage_header = stripslashes($mypage['page_header']);
$mytext = stripslashes($mypage['text']);
$mypage_footer = stripslashes($mypage['page_footer']);
$mysignature = stripslashes($mypage['signature']);
$mydate = $mypage['date'];
$mycounter = intval($mypage['counter']);

-------


Thank you very much,
Micah
 
View user's profile Send private message
wHiTeHaT
Life Cycles Becoming CPU Cycles



Joined: Jul 18, 2004
Posts: 579

PostPosted: Sat Apr 17, 2010 9:01 am Reply with quote

put in your header.php , search for $pagetitle below add:
global $mytitle;
if ($name =='Content' && isset($mytitle)){
$pagetitle = '-'.$mytitle;
}else{
$pagetitle = 'Content';
}
 
View user's profile Send private message Send e-mail
micah







PostPosted: Sat Apr 17, 2010 9:19 am Reply with quote

Hi and thank you very much but

below is my header.php file. Which $pagetitle do I place that code after?


function head() {
global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $hr, $theme, $cookie, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle;
$ThemeSel = get_theme();
include_once("themes/$ThemeSel/theme.php");
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
echo "<html>\n";
echo "<head>\n";
echo "<title>$sitename $pagetitle</title>\n";
include("includes/meta.php");
include("includes/javascript.php");
if (file_exists("themes/$ThemeSel/images/favicon.ico")) {
echo "<link REL=\"shortcut icon\" HREF=\"themes/$ThemeSel/images/favicon.ico\" TYPE=\"image/x-icon\">\n";
}
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"backend.php\">\n";
echo "<LINK REL=\"StyleSheet\" HREF=\"themes/$ThemeSel/style/style.css\" TYPE=\"text/css\">\n\n\n";
if (file_exists("includes/custom_files/custom_head.php")) {
include_once("includes/custom_files/custom_head.php");
}

echo "\n\n\n</head>\n\n";
if (file_exists("includes/custom_files/custom_header.php")) {
include_once("includes/custom_files/custom_header.php");
}
themeheader();
}

thanks ,
Micah
 
wHiTeHaT







PostPosted: Sat Apr 17, 2010 10:39 am Reply with quote

between:
Code:


echo "<head>\n";
//HERE//
echo "<title>$sitename $pagetitle</title>\n";
 
wHiTeHaT







PostPosted: Sat Apr 17, 2010 10:42 am Reply with quote

Replace your function with this 1
Code:


function head() {
global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $hr, $theme, $cookie, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle,$mytitle,$name;
$ThemeSel = get_theme();
include_once("themes/$ThemeSel/theme.php");
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
echo "<html>\n";
echo "<head>\n";
if ($name =='Content' && isset($mytitle)){
$pagetitle = '-'.$mytitle;
}else{
$pagetitle = 'Content';
}
echo "<title>$sitename $pagetitle</title>\n";
include("includes/meta.php");
include("includes/javascript.php");
if (file_exists("themes/$ThemeSel/images/favicon.ico")) {
echo "<link REL=\"shortcut icon\" HREF=\"themes/$ThemeSel/images/favicon.ico\" TYPE=\"image/x-icon\">\n";
}
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"backend.php\">\n";
echo "<LINK REL=\"StyleSheet\" HREF=\"themes/$ThemeSel/style/style.css\" TYPE=\"text/css\">\n\n\n";
if (file_exists("includes/custom_files/custom_head.php")) {
include_once("includes/custom_files/custom_head.php");
}

echo "\n\n\n</head>\n\n";
if (file_exists("includes/custom_files/custom_header.php")) {
include_once("includes/custom_files/custom_header.php");
}
themeheader();
}
 
micah







PostPosted: Sat Apr 17, 2010 11:25 am Reply with quote

Hi Again,

I am so sorry ... but that does not still seem to work for me

This is my header.php


function head() {
global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $hr, $theme, $cookie, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle, $mytitle, $name;

$ThemeSel = get_theme();

include_once("themes/$ThemeSel/theme.php");

echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";

echo "<html>\n";
echo "<head>\n";

global $mytitle;
if ($name =='Content' && isset($mytitle)){
$pagetitle = '-'.$mytitle;
}else{
$pagetitle = 'Content';
}

echo "<title>$sitename $pagetitle</title>\n";


Do I need to make any changes in the content index.php file ?

Again ... thanks .. sorry.

Micah
 
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Sat Apr 17, 2010 12:59 pm Reply with quote

what happens if you just try to echo $mytitle ?

echo "<title>$mytitle</title>\n";

I'm guessing it has not been defined at the time header.php is loaded.

Since you are not using RN, have you considered TegoNuke(tm) DynamicTitles instead?
http://montegoscripts.com/download-file-38.html
 
View user's profile Send private message Visit poster's website
wHiTeHaT







PostPosted: Sat Apr 17, 2010 1:54 pm Reply with quote

you must quote out the $pagetitle = "- $module_name"; in your index.php of the content module.

like:
//$pagetitle = "- $module_name";
 
micah







PostPosted: Sat Apr 17, 2010 1:55 pm Reply with quote

I just tried out TegoNuke(tm) DynamicTitles but it still only prints out mysite - Content

I am looking for it to print out - the title of each of my content pages.
-


Micah


Last edited by micah on Sat Apr 17, 2010 3:43 pm; edited 1 time in total 
micah







PostPosted: Sat Apr 17, 2010 2:05 pm Reply with quote

Whitehat - I just tried #$pagetitle = "- $module_name";

but this still does not do the trick.

It still prints out sitename Content

Micah
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Sat Apr 17, 2010 5:24 pm Reply with quote

micah wrote:
I just tried out TegoNuke(tm) DynamicTitles but it still only prints out mysite - Content

I am looking for it to print out - the title of each of my content pages.
-


Micah


Micah,

Does your copy of Dynamic Titles have this code in it:

Code:


/*
 * Content
 */
elseif ($name == 'Content') {
   global $pa, $cid, $pid;
   if ($pa == 'list_pages_categories') {
      $sql = 'SELECT title, description FROM ' . $prefix . '_pages_categories WHERE cid=\'' . intval($cid) . '\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $newpagetitle = $row['title'] . $dt_sDelim . $row['description'] . $dt_sDelim . $sitename;
   } elseif ($pa == 'showpage') {
      $sql = 'SELECT title, cid, subtitle FROM ' . $prefix . '_pages WHERE pid=\'' . intval($pid) . '\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $asDTText['subject'] = $row['title'];
      if ($row['subtitle'] != '') {
         $asDTText['subject'] .= $dt_sDelim . $row['subtitle'];
      }
      $sql = 'SELECT title FROM ' . $prefix . '_pages_categories WHERE cid=\'' . intval($row['cid']) . '\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      if ($row['title'] == '') {
         $newpagetitle = $asDTText['subject'] . $dt_sDelim . $sitename;
      } else {
         $newpagetitle = $asDTText['subject'] . $dt_sDelim . $row['title'];
      }
   }
}


If so, then what Content module are you using? It must not be the standard PHP-Nuke 8.0 one?

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
jestrella
Moderator



Joined: Dec 01, 2005
Posts: 593
Location: Santiago, Dominican Republic

PostPosted: Sat Apr 17, 2010 11:03 pm Reply with quote

Give a try to Content Plus...
http://slaytanic.sourceforge.net/modules.php?name=Downloads&op=getit&lid=1

_________________
"For those whom have not reach the sky... Every mountain seems high"

Best Regards
Jonathan Estrella
http://about.me/jestrella04 
View user's profile Send private message Visit poster's website
micah







PostPosted: Sat Apr 17, 2010 11:21 pm Reply with quote

thank you for all of your help. after many hours and all of your help I solved the problem.

Again thanks to all

Micah
 
montego







PostPosted: Sun Apr 18, 2010 3:20 pm Reply with quote

micah wrote:
I solved the problem.


Can you give us an idea what the issue was in case others stubble upon this thread?

Thanks.
 
micah







PostPosted: Sun Apr 18, 2010 3:28 pm Reply with quote

One of the main problems was that the header.php file include is placed too high in the script. I lowered it to below the functions where it seemed to work.
 
jestrella







PostPosted: Sun Apr 18, 2010 7:40 pm Reply with quote

header.php should be one of the first scripts to be included, the first one at last... You could be breaking standards including this file lower in your script... Can you please provide a link to your site so we can have a look?
 
micah







PostPosted: Sun Apr 18, 2010 7:52 pm Reply with quote

I have now upgraded to content plus. This is what I should have done in the first place. Seems like a way better way to go.
 
jestrella







PostPosted: Sun Apr 18, 2010 7:56 pm Reply with quote

You've been warned!!! Laughing
 
micah







PostPosted: Sun Apr 18, 2010 8:03 pm Reply with quote

I dont understand. What have I been warned about? Also what does it mean by breaking standards? did I do something wrong?
 
jestrella







PostPosted: Sun Apr 18, 2010 8:10 pm Reply with quote

It was just a joke... been warned to use Content Plus that is far better alternative. Laughing By breaking standards i mean your code could not be compliant with W3C standards foor the world wide web

Read this for more reference...
http://validator.w3.org/docs/help.html#validation_basics
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©