Closed Thread Icon

Topic awaiting preservation: PHP: variable usage in Title tags (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12371" title="Pages that link to Topic awaiting preservation: PHP: variable usage in Title tags (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: PHP: variable usage in Title tags <span class="small">(Page 1 of 1)</span>\

 
Boudga
Maniac (V) Mad Scientist

From: Jacks raging bile duct....
Insane since: Mar 2000

posted posted 08-20-2002 21:01

I am creating some PHP script that dynamically writes new webpages with "clientname: pagename" style Title tags and I would like to know if there is some way to assign a variable to that like "clientname: $pagename"? I have the PHP4 Bible and I don't see anything in there with regards to do that.

maybe someone could point me to a URL that may explain how I can do that.

genis
Paranoid (IV) Inmate

From: Dallas, TX
Insane since: Aug 2002

posted posted 08-20-2002 22:14

pagename being the title of the page?

or the filename of the page?

latter is easier to do, former is harder albeit still doable.



[This message has been edited by genis (edited 08-20-2002).]

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 08-20-2002 22:56

Boudga: Do you mean use PHP to write into <title></title> tags or something more complex?

___________________
Emps

FAQs: Emperor

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 08-21-2002 00:34

If that's the case, do what I do....

echo the info into a javascript variable, then use it for document.title. Such as:

<script type="text/javascript" language="javascript">
var blah = <?=$myphptitle ?>;
document.title = blah;
// or
// document.title = "This is my cool page: " + blah;
</script>

Blacknight
Bipolar (III) Inmate

From: INFRONT OF MY PC
Insane since: Dec 2001

posted posted 08-21-2002 02:40

in php? i only know asp but i would do it like this:

make recordset lets say rs
open the connection (mysqstatement)
then

<title><% response.write rs("Title") %>

Translate this to php and that should work

If i got your point right

Boudga
Maniac (V) Mad Scientist

From: Jacks raging bile duct....
Insane since: Mar 2000

posted posted 08-21-2002 03:58

I believe Pugzly is right on in determining from my dribble what I want to do...thanks Pugzly I'll give that a whirl!

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 08-21-2002 13:38

Well why don't you echo it straight into the <title></title> tags - that would seem more direct?

___________________
Emps

FAQs: Emperor

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 08-21-2002 15:15

In my case, I can't echo it right to the <title>, since the <title> is in my header file, and the PHP/MySQL stuff is actually in the content page.

Either way would work.....

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 08-21-2002 15:39

Another thing you can do is devise some sort of unique tag to put in the header file so you can read the file into a variable and do a str_replace with the variable in the page. For the Content management system I've been creating, I use <%% %%> tags. I thought of using XML, but it is so inefficient from a parsing standpoint.

-jiblet

« BackwardsOnwards »

Show Forum Drop Down Menu