Web Hosting Talk







View Full Version : Mucho help for php title, please


JRSEOMarketing
04-27-2009, 04:23 PM
I'm definitely not a programmer, so kindly assist.

I'd like the category title to show before the page_title title.

The original Text
<title><? print $page_title." - ".$SETTINGS['sitename'];?></title>

This script is the header template for PhpAuction.

tim2718281
04-27-2009, 04:34 PM
I'm definitely not a programmer, so kindly assist.

I'd like the page_title to show before the sitename title.

The original Text
<title><? print $SETTINGS['sitename']." ".$page_title;?></title>

I would like the page_title before the sitename.

Here you are:

<title><? $page_title . " " . print $SETTINGS['sitename'] ; ?></title>

The . is an operator in the programming language, to join two strings together.

The " " is one blank character

So the . " " . is joining the preceding string and the following string with a blank between them.

The <title> ... </title> are HTML tags telling the browser that what''s between is the web page title.

The <? ... ?> are telling the server that what is between them is a server script. Doubtless one day you'll be told it's better to code <?php ... ?> which is true.

$page_title and $SETTINGS['sitename'] are for practical purposes data that has been set to the page title and the site name.

Isn't it amazing just how much stuff programmers take in? When you consider a small program might have a thousand lines of code, you can see why there are so many errors in programs ...

fwaggle
04-27-2009, 04:57 PM
Leave "print" at the start of the php line though. ;)

tim2718281
04-27-2009, 05:26 PM
Leave "print" at the start of the php line though. ;)

Well done, I wondered who'd be first to spot that ... :-)

<title><? print $page_title . " " . $SETTINGS['sitename'] ; ?></title>

JRSEOMarketing
04-27-2009, 06:40 PM
Update: Please note the changes I put in:


I'd like the category title to show before the page_title title.

The original Text
<title><? print $page_title." - ".$SETTINGS['sitename'];?></title>

This script is the header template for PhpAuction.

HivelocityDD
04-28-2009, 10:42 AM
That must be working. You can try the following too


<title>
<?php echo "{$page_title} - {$SETTINGS['sitename']} "; ?>
</title>


Thanks

JRSEOMarketing
04-28-2009, 03:06 PM
Is there anyone experienced with PhpAuction that knows how to put in the categories page into the title?

I tried $category_title and $cat_title but neither worked.

JRSEOMarketing
04-28-2009, 03:20 PM
Solution:

<title><? print $page_title." ".$category['cat_name'];?></title>

In case anyone has this question in the future. See above...

I have a working example if you need to see it. Privmsg if you have further questions.

Thanks for the help above!