Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Get A Page Title And Assign It To A Variable


Is there a command or a procedure to get a page title and assign it to a php variable.




View Complete Forum Thread with Replies

Related Forum Messages:
Page <title> From Include Variable?
I have something like this:

<title><?php print($pagetitle); ?></title>
<body>
<?php include("folders/my_include.php"); ?>
</body>
</html>

and my_include.php contains the value to the variable ($pagetitle). How do I
get the value before the code for the <title> is written. This is just a
basic example I used to try and put across my question, my site has a whole
bunch of includes dynamically generated from user input. I'd just like to
get the <title> to change according to a variable in the includes......but
Im stuck?

I should say also that all my includes have includes themselves, they
include a html template. So placing <?php include("folders/my_include.php");
?> before the title tag won't look very good :)

View Replies !
Changing The Page Title With A Variable
All my page titles have been the same thing, and I was wondering if there's any way to do something like <title <?php echo $title; ?> then in the page have <?php $title = "Page Title"; ?>

View Replies !
Assign Value To Variable
Is there any way I can use a function to create a variable and assign
a value to it? I have a Perl script that returns some LDAP
information:

sn=Shore
givenname=Mike
logintime=20041008153445Z
logindisabled=FALSE

Instead of parsing this text and assigning the values, I was wondering
if a function exists where I can pass a variable name and a value, and
the variable would be created.

ie. somefunc("sn", "Shore")

Would create the variable $sn and assign the value "Shore" to it.

View Replies !
Assign To Variable
I am trying to take data from the database and assign it to a variable but i'm not sure how this is the code ive been trying

$sql = "SELECT Name FROM Names WHERE Name = 'Peter'";

while($row = @mysql_fetch_array($sql))
{
$var == $row['Name'];
}

View Replies !
Assign Javascript Variable To PHP Variable
i have select option on my website.When i choose select option  the value of selecet option which i get in the javascript want to assign to PHP variable .So that i can use that in the query.

View Replies !
How Can I Assign Output To A Variable?
I'm trying to send an email and would like to put the output of some of my script into the body of the email. Here's the part that needs to be executed: PHP Code:

View Replies !
Is It Possible To Assign A Whole Function Or Block To A Variable ???
Is it possible to assign a whole function or block to a variable ???

eg.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<? if (db_num_rows($qid_p) == 0) { ?>
<li>No
<? } ?>
<? while ($prod = db_fetch_object($qid_p)) { ?>
<p><b><a href="product_details.php?id=<?=$prod->id?>"><? pv($prod->name) ?></a></b>
<br><? pv($prod->description) ?>
<br>$<? pv($prod->price) ?>
<br>[<a href="cart_add.php?id=<?=$prod->id?>">+ Add to Cart</a>]
<? } ?>

How to assign this code to a unique variable ???

View Replies !
Assign Function Output To Variable??
I've found some references to this topic at :
http://forums.devshed.com/showthrea...ion+to+variable
but it does not seem to be working for me.

here's a snippet...

<? PHP
function listPeople ($getArray)
{
foreach ( $getArray as $val )
{
echo "$val, ";
}
}

$foo = listPeople($splitDirector);
?>

The function works, and as you can see i'm simply trying to assign the output of the function to $foo. But instead, the output is written to the page where I assign it... like a print or echo statement, and the variable $foo is empty.

View Replies !
Ways To Assign A Value To A Session Variable.
I am wandering which way to assign a value to a session variable
exist. Which of the following examples will work.

Example #1:
session_start();
session_register("ex");
$ex = 2.0;
Example #2:
In first.php:
session_start();
session_register("ex");
In second.php:
$ex = 2.0;
Example #3:
In first.php:
session_start();...

View Replies !
Assign Variable From Database Field
Is there a way to assign a variable from a database field? I'm thinking along the lines of

$make = $row_rsList['make'];
$model = $row_rsList['model'];

then they'll switch out based on my SQL WHERE statement. This valid syntax?

View Replies !
Assign Userid To A Session Variable
When a user logs into my system, i assign their userid to a session variable

[php]
$_SESSION['userid'] = $myrow[0];
[php]

and then a user logs out, i do the following

[php]
$_SESSION['userid'] = ''
session_write_close();
[php]

so, when a user clicks on a link to a page they should only see when logged in, i do the following test

[php]
if (isset($_SESSION['userid']))
{
header('Location: members.php3');
}

[php]

but the logout does not seem to work for some reason? userid still seems to be set after running the logout script, any ideas? am i doing something silly?

View Replies !
Assign Dynamic Dropdown To Variable?
Is it possible to assign a dynamic dropdown script to a $variable? Code:

View Replies !
Assign A New Value To A Variable Passed From An Html Form
I'm trying to assign a new value to a variable passed from an html form to a php3 script. I'm using an if statement to evaluate variable 3 to see if it is equal to a specific string, if it is I'm reassigning variable 2 to be variable2+variable 3.

if ($question3!="select days")
{
$question2=$question2+$question3;
}

This is the statement. It keeps giving me a parse error and I can't seem to find the right documentation to show me how to combine two string variables.

View Replies !
How To Assign Data In A Table Field To A Variable
what exactly do i do to only retrieve information from a table and assign it to a variable? I don't want to manipulate the data in any way, just display it on the page.

View Replies !
Multi-Dimensional Arrays - Assign Variable
It's a simple question, but I'm just not
getting it.

I have two files:

<?php
$precinct = array (
array ( number=>2324,
centerlat=>-122.31705665588379,
centerlong=>47.710367959402525,
etc...

<?php
include ("precinctdata.php");
$filename = $_GET['id'];
$number = $precinct[filename-1][number];
etc...

I want to assign the value of "2324" to the variable $number. I've done
this with arrays that start with number=>1, 2, 3, etc., but not successfully
with specific values.

What am I missing?

View Replies !
Assign MySQL Function Result To PHP Variable
I know to use: mysql_fetch_row($result) to convert a row from a SQL query result set into an array for use with PHP. but in the case of SQL queries that return one value, such as calls to MySQL functions, is there another PHP mysql api function I should use.

For example, right now I use a "workaround" technique from PHPBuilder:
$result=mysql_query("SELECT COUNT(*) FROM tablename");
list($numrows)=mysql_fetch_row($result);

Rather than using this "workaround" code is there a way to simply assign the result of the MySQL function query to a variable.

$result=mysql_query("SELECT COUNT(*) FROM tablename");
$numrows=mysteryfunction($result);

View Replies !
Assign Variable To A Block Of Html Code
Is it possible to assign variable to a block of html code?
Something like this :

$myblokvar = "<table width="487" border="0" cellspacing="0" cellpadding="0">
<tr> <td><table width="487" border="0" cellspacing="0" cellpadding="0">
<tr> <td><img src="images/bartitle_login.gif " alt="Login" width="475"...

View Replies !
Count The Number Of Matches And Assign A Variable For Each One
I've been trying to work out a problem but I'm having no luck. I have
field in my table for area and I need to count the number of matches
and assign a variable for each one.. this is what I have but it doesn't
work.. any ideas? Code:

View Replies !
XML: Assign A Variable To TransactionArray.Transaction.TransactionID Where User ID =?
I want to be able to find and assign a PHP variable to the Transaction ID where the UserID is a specified user though Ebays XML API. Code:

View Replies !
Page Title
I have another post on here for this problem but I think I have overcomplicated the matter.. Ok in it's simplest form: Is there a way to retrieve the current page title and place it into a PHP variable?

something like"

$pagetitle = **** Title of the current page I'm viewing ****

View Replies !
Title Of Page
On an arbitrary web page, I would like the code to return the web path to that page and including the title of that page. The purpose is to provide folks who might want to link to the page the actual code they need to make the link by cutting and pasting the code into their own site. Something like this: Code:

<a href="http://www.phpbuilder.com/example.php">Page Title</a>

View Replies !
In Page Title
I'm trying to put some php in a web page title (after the text part of the title), so that it will number each page differently in the title. Whats the best way to do it? Is there some sort of taboo against putting too much code in the <title></title> of the page?

Or is it anything goes as long as it isn't too rediculous. Heres the part of the code that determines what page number it is. In the browsers output all I am getting is all this code in the title though, instead of just 1, 2, etc. or whatever page it is on. Whats the proper way to put Code:

View Replies !
Title Of My Page
Im very new to php. Is it poosible to do something to include the tilte of my page in the body of my page.

View Replies !
Getting The Page Title
I'm trying to do is find a way of getting the page title (the bit between <title> and </title>) from a string that represents that contents of a webpage. I've spent an hour and 41 minutes researching this one on Google and can't find a solution.

View Replies !
Assign Variable Name As Variable
I want to be able to create a foreach loop that will go through all the intended POST variables and then assign it as a standard variable.

For example, I want to have $username = $_POST['username'] without even knowing username exists in the context of the foreach loop. Code:

View Replies !
How To Get Page Title, In Not An Easy Way
ok, here is the situation

i have included header.php into index file but
i have this in index.php:
[php]
switch($_GET['action']) {
case 'page':
$pages[0] = "news0.php";
$pages[1] = "news1.php";
.
.

if ($_GET['page'] != "") {
$to_include = $_GET['page'];
include ($pages[$to_include]);
}
break;
default:
include("news.php");
[php]


i tried all sort off stuff like implode, pregmatch,ordinary passing $title variable, $_PHPSELF, and nothing seems to be working.

all i want to do is to get title like domain.com-news.

can anybody give me a tip what should i do?

View Replies !
Can I Change The Title Of A Page
Maybe this is a stupid question, but is it possible to randomly change the title of a page with PHP?

View Replies !
Page Title Into Database
i am trying to make a script that will get the title of a page amd add it to a database.
PHP Code:

View Replies !
Setting The Page Title
I want all of my web pages to look like this

<?php $title = 'My site'
include('http://mySite.com/layout/page_begin.php'); ?>
.... HTML of page body goes here
<?php include('http://mySite.com/layout/page_end.php'); ?>

But, I can't even get the first bit working :-(

here is page_begin.php

<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=ISO-8859-1">
<link type="text/css" rel="stylesheet" href="/layout.css">
<HTML>
<HEAD>
<TITLE>' <?php print $title ?> '</TITLE>
</HEAD>
<BODY>

The $title evaluates to an empty string - what obvious thing am I
overlooking? I thought that include would inline the php file, thus
making $title available.

View Replies !
Changing Title Of Page
does anyone know how to use PHP to change the title of a page?

Let's say my title is currently "GOGOGO" , but I want to add a string "$x" to it

so it says "GOGOGO $x", using PHP does anyone know how to do that?

View Replies !
Obtaining Page Title
I was wondering if someone could tell me the easiest way to obtaining the page title of a specific url? I've tried to use fopen and those functions but I got the below error.

QuoteWarning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /home/web/ute.php on line 2

View Replies !
Getting The Page Title For The Sub Menu?
how I could get the page title for the sub menu? I have been working on this one for hours and am getting nowhere. How can I make my php code display the syntax highlighting? I have forgotten. Code:

View Replies !
Changing Page Title
I'm trying to write a PHP page that takes values from two db fields to generate the title meta tag from a value in my database. I've got all the database connection stuff working but the problem is that I can only show one field info as a title.

The following is working file, where it is getting only the value of $strBrandName and showing it well. <title><?php echo $strBrandName + $strModel;?></title> . When I want to combine the value of BrandName and Model it is not working. <title><?php echo $strBrandName + $strModel;?></title> I think may be my "+" is wrong.

View Replies !
Displaying The Title Of A Page
On a page where the user clicks a link (which is an array of link id's and names that is retrieved from a database), this information is passed to a page called show_link.php It is on this page that I want the link name to appear in the HTML <title> attribute.

View Replies !
PHP To Grab Page TITLE And Check For 404 Help
I am looking for a way to pull the <TITLE> from a web page. Does anyone know
a PHP routine or method that can help?

Also, I am looking for a way to test if a page is active. The ping returns
the website is there (But also returns true on a 404 error), But I want to
know if a page is "dead" (404 or other error) or active.

View Replies !
Text Reflecting On Page Title
if it is possible to reflect the page title inside the document itself. An example would be like this;

The page title is ?' minus the quotes
And i would like to display something like 'This page was made on the 1st of January 2007'

Notice how the page is a shorthand date. I have tried difing Arrays in the title tag, but they always seem to appear as the actual title. which doesn't look right and am sure will deter visitors.

View Replies !
Grabbing Page Title And For Echo ()
Is there anyway I can grab the information from between the <title></title> tags so I can echo it out somewhere ?

View Replies !
How To Extract A Page Title From An HTML File
I am trying to extract the page title, description and keywords from an HTML page. Description and Keywords are easy, using get_meta_tags().

View Replies !
How To Dynamically Change Page Title Using Php And Require_once?
This is an elementary question, but I've not been able to find the
answer, so here goes:

I am developing a site using php. I have the html header information
in a file that I include in all the pages using the require_once
function.

That is, each page includes the line

<?require_once('PageStart.php')?>

The PageStart.php file essentially defines the header. Omitting the
boring stuff, it's laid out like so:

<html>
<head>
<title>The Title of the Page</title>
<?require_once('styles/PageStyles.css')?>
</head>

<boring stuff snipped>

This works great. The only complaint I have is that there are LOTS of
pages on the site, and using this approach means that every page is
titled "The Title of the Page" When scanning my browser history, I
could have surfed to 30 different pages in the site and they all have
the same title. Makes it hard to know which page I'd like to go back
to.

I'd like to have a way to pass a (sometimes) dynamically generated
page title to the PageStart.php file. I say sometimes because certain
pages (the Main one for example) will always have the same title, so
that could be passed statically. There is another series of pages in
which the same php file accesses a MySQL database to display
information about various family members, and I'd like that title to
be generated dynamically (for example, "All about Mary" or "All about
Ted" depending on the person being described in the page).

Now I KNOW that with php there's a way to do this. I just can't find
it.

View Replies !
Dynamic Page Title Based On URL Variables?
I am setting the title for a drupal site of mine with the following script:

<?php
drupal_set_title($_GET['Foo1'].' '.$_GET['Foo2'].' '.$_GET['Foo3']);
?>

that's working just fine... but I want to include some additional text in the title like this:

"search.php?Foo1=Bar1&Foo2=Bar2&Foo3=Bar3" ... title would be "Bar1 Bar2 Bar3 TEXT"

How can I insert additional text into this output? Can I put an echo in here somehow?

View Replies !
Page Title Change To Correspond Theme
I have poetry.php that allows users to select a title of a poem, which passes a variable through the URL and the poem is then displayed on the same page. I figured I should have the page title change to correspond with the poem selected. If no piece is selected, then no special title text is added to the page title. Code:

View Replies !
Extract The TITLE Section Of A Web Page Using Preg_replace()
I went through some examples, tried a bunch of things. but still can't figure out why I can't extract the TITLE section of a web page using preg_replace():

<?php
$response = file_get_contents($url);
$output=preg_replace("|<title>(.+?)</title>|smiU",
"TITLE=$1",
$response);
$fp = fopen ("output.html", "w");
fputs ($fp,$output);
fclose($fp);
-----------

View Replies !
Form To Header For Custom Page Title
Been searching through the forum and found a couple of related topics but still confused as to which direction to take my next step.

I have a neat script working(which I will gladly share ) and want to add an admin feature that allows user to write a custom page title to the header.php file. Also add custom text to other parts of the site so as to create a template like website.

Okay! I got the form to enter the data into the database, now how do I get it to echo between the <title> tags?

View Replies !
Meta Tags - Change The Individual Page Title
how I can change the individual page title, description and keyword details for them. Presently, they are all the same and want to personalise each page.

View Replies !
$title Not Displaying In <title>$title</title>
For some reason $title will not display in the <title></title> using print or echo. I've tried modifying the if staments to ifelse, and even fiddled with $_GET to get this working. Tried dbl/single quotes, even changed the variable around thinking $title might be a global. nothing working yet. Any ideas?

<?php
$page == 'home'
$title == "Welcome!";
if ($page == 'home') { $title == "Welcome!"; }
elseif ($page == 'about') { $title == "about us"; }
elseif ($page == 'products') { $title == "Products"; }
elseif ($page == 'services') { $title == "Services"; }
elseif ($page == 'repair') { $title == "Upgrades & Repairs"; }
elseif ($page == 'network') { $title == "Network Solutions"; }
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>My Site - <?php print "$title";?></title>
</head>
<body bgcolor="#FFE0C1">
...

View Replies !
Display Article's Title In Title Tag
I want to show the article's title in the title tag. But I can't display the title from the article because the title tag is loaded first and the the rest of my page.

I have a solution with javascript but if you haven't enable javascript, you'll see nothing so I want to do this with PHP, but how. Code:

View Replies !
I Need Information From To ......
I have to retrive the title tag information? can you tell me. i
am new to the php ........

can you give the example to get the information between <title> to </title> from the web page...... how shall i get it.

View Replies !
Convert ##TITLE## To $title
Im half way through making an article manager for a new site im launching. If i type ##TITLE## into a text box, when i display the artcile, how do i turn the placeholder ##TITLE## into $title of the article.

i looked at str_replace but i dont think thats what i need... i need something that searched through the text of a var and if it finds anything within ##*## to convert the * into the $var.

View Replies !
Pass The Variable From 1st Page And Read It With Other Name On 2nd Page
I am new to this and learning slowly, but I was hoping someone could give me some quick advice on how to create a variable on one page and have it passed to another to be read as an ID for a mySQL database.

I want to pass the variable "varRevID" from one page and have it read as "reviews_id" on the other.

My database is pulling from just the first record and I would liek to designate from the pointing page which record to pull from.

View Replies !
Setting A Variable That Stays From Page To Page
how can I define a variable that can be recalled from different pages without having to be defined again?

View Replies !
Copy A Variable From One Page To Another Page?
How do I copy variable from one page to another page in PHP? For example: I want to put a $var in page A into page B.

View Replies !
Cannot Re-assign $this ...
I'm one more guy having the cannot re-assign $this problem.

someone left a php4 file here containing the lines

|function linkbar()
|{
|if(func_num_args() == 1)
|{

|$this = func_get_arg(0);
|return;
}
...
|}

inside a php4 class definition. func_get_arg(0) in this case delivers
an object - working fine in php4. I struggled a bit with the &
referencing (while not really understanding it and the problem) but
gave up. how must I modify the code to get it to work in php5?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved