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 Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
$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 !
View Related
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 !
View Related
Get Title?
How do you get the title of a(n) external webpage? Ive seen it done on the vBulletin's software. Anyone know how to exactly do this? Or is there a PHP function already added to the PHP software that I don't know about.
View Replies !
View Related
<title>
im trying to put the title of the page to my file and i keep getting headers sent messages ... i tried ob_start(); and it still wont work how would i go about putting <title>my title ... </title> to my file below? Code:
View Replies !
View Related
Title
Why doesn't the contents of the "title" field get displayed on the screen? <?php $con = mysql_connect("localhost","ODBC",""); if (!$con) { die(mysql_error()); } mysql_select_db("MP3", $con); $result = mysql_query("SELECT * FROM books"); echo $result['title']; mysql_close($con); ?>
View Replies !
View Related
Title,URL
I have the following example that will extract the TITLE from a web page successfully but how can I extract the TITLE from a "redirected" link. <?php $file = fopen ("http://www.example.com/", "r"); if (!$file) { echo "<p>Unable to open remote file. "; exit; } while (!feof ($file)) { $line = fgets ($file, 1024); /* This only works if the title and its tags are on one line */ if (eregi ("<title>(.*)</title>", $line, $out)) { $title = $out[1]; echo "$title"; break; } }fclose($file); ?>
View Replies !
View Related
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 !
View Related
Match Title
I am trying to get a the title out of a html page, I have the html code loaded into a variable. The only thing is sometimes the title is not on the same line. <title>need this text</title> $title = preg_match(/<title>s</title>/i, $html); help me with this match syntax?
View Replies !
View Related
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 !
View Related
Title Tag In Mozilla
$varible is "3 lines text........................... ...................... ........................"; I have used echo "<img src="../images.gif" tilte="$variable"></img>"; But on tooltip all the 3 lines is shown in a single line with mozilla browser. In IE it is shown in separate lines. How to avoid the problem of displaying the tooltip in a single line with mozilla firefox.
View Replies !
View Related
Change The Title
I'm trying to change the title on just my home page. Can anyone help me where I should insert it and how I should insert it in this code. <title><?php if ( get_bloginfo('version') < ƈ' ) : echo wp_title('',false); if (!is_home() ) : echo ' - ' endif; elseif ( is_search() ) : echo wp_specialchars($s).' - ' elseif ( is_category() ) : single_cat_title(''); echo ' - ' elseif ( is_year() ) : echo get_the_time('F').' - ' elseif ( is_month() ) : echo get_the_time('F Y').' - ' elseif ( is_day() ) : echo get_the_time('F jS, Y').' - ' elseif ( is_404() ) : echo "Not found - "; elseif (!is_home() ) : if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; }; echo " - "; endif // is_search()?> <?php bloginfo('name')?></title>
View Replies !
View Related
Add Html Title
How do you add a (html title) to this image? $Cat .= "<tr> <td style="padding:0px"> <caption align=center style="padding:0px"> <img src="myimages/pic1.gif" border="0" > </caption> </td> </tr>";
View Replies !
View Related
Dynamic Title With From Db
I use a header.php page and a content.php page. The header.php is of course just the header, the content.php is database driven. I want the article title on the content.php page to display in the Title bar. Code:
View Replies !
View Related
Preg_match For Title
I have a simple function that extracts the contents of <title> tag from the files in a given folder. function getTitle($filePath) { $content = file_get_contents($filePath); if(preg_match('#<title>(.+?)</title>#msi', $content, $matches)) { return $matches[1]; } return 'Untitled' } However, some pages contain the title as <title><? echo $thisPage; ?></title> and the function returns echo $thisPage; without interpretation. Could anyone help find out how to make this readable by preg_match?
View Replies !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
Title Replace Problem
Here is some of my upload code i am using but i am having problems trying to insert the title into the database, the first is with spaces allowed and the second is without spaces and filled with _ instead, but it wont do it. I have this a value called $title and this is the title a user gives their submission, and i want to rename the file the same as the title but with the spaces replaced with _ u following me? I have done it do it does this but when it inserts the title into the database, the spaces are replaces with the _ instead of leaving it alone.
View Replies !
View Related
Dynamic Title Issues > Help Please!
Here is my problem: First, I am talking about two files. page.php which serves as the main content page and header.php which contains the obvious header information. page.php contains the code listed below. I am I am trying to get the <title></title> tag to echo the headline which is described below. The only way of doing this that I have found is copying all of the data below into the head file and placing the <?php echo "?> data into the <title> </title> tags. That works like a charm! The only problem is I am running into duplicate scripts running which then causes the body (page.php) not to show up. Dynamic titles work fine. Any ideas? Suggestions? Help! Thanks. <?php if (!isset($_REQUEST['page'])&&!isset($_REQUEST['story'])) { header('Location: index.php'); exit; } $page = $_REQUEST['page']; $story = intval($_REQUEST['story']); include_once('db_fns.php'); include_once('header.php'); $handle = db_connect(); if($story) { $query = "select * from stories where id = '$story' and published is not null"; } else { $query = "select * from stories where page = '$page' and published is not null order by published desc"; } $result = $handle->query($query); while ($story = $result->fetch_assoc()) { // title $title = 'Hello!' // headline $id = $story['id']; echo "<a href='page.php?story=$id'><h2>{$story['headline']}</h2></a>"; //picture if ($story['picture']) { echo '<div style="float:right; margin:0px 0px 6px 6px;">' echo '<img src="resize_image.php?image=' echo urlencode($story[picture]); echo '&max_width=200&max_height=120" align = right/></div>' } // byline $w = get_writer_record($story['writer']); echo '<br /><p class="byline">' echo $w[full_name].', ' echo date('M d, H:i', $story['modified']); echo '</p>' // main text echo $story['story_text']; } include_once('footer.php'); ?>
View Replies !
View Related
META And TITLE Tags?
I have a bunch of pages, all of which use a common interface. Thus, the site is ideal for implementing some kind of template using the include() function. I want all my pages to look something like the following: PHP Code:
View Replies !
View Related
Puttin Title And Body Into One
I have a field for title/intro and then the main body. Is it possible to put them all together into $post so that I can search thru all of the article instead of just the main body, or how else could I do this. I am wokrin off this tutorial: http://www.phpbuilder.com/columns/c...421.php3?page=2
View Replies !
View Related
Retrieve <TITLE> In Php Code ?
Simple question, but headache ! I have a PHP Page like : <HTML> <HEAD> <TITLE>Sunny day !</TITLE> </HEAD> <BODY> <? echo "The title of this page please (Sunny Day !)" ?> </BODY> </HTML> I think that you have understanding my problem : How to retrieve the title of my page ?
View Replies !
View Related
How Can I Hide A Title Bar In A Nw Window.
I am oening a new window from javascript function window.open('imgShow.php','ImageName', 'width=100,height=100,titlebar=no, screenX=' + x + ',screenY=' + y + ',left=' + x + ',top=' + y); I added titlebar=no Still its showing titlebar. I want to hide title bar as well as minimise and close option. I want no border to HTML page. Can anyone suggest me what are the possible options to do this. I have a grid of picture and on mouseover i want to show big image over it.
View Replies !
View Related
Get_meta_tags Prblm If <title> Contains A '
I have a source html file. I use the get_meta_tags function to parse the content of meta, such as description. It works fine, but in a particolar situation it does not works. If I have:inside head section: <title>Il mio nome e' pippo</title> <meta name="description" content="ciao ciao"> then calling PHP Code:
View Replies !
View Related
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 !
View Related
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 !
View Related
Displaying Title As A Link
I'm developing a simple CMS which displays the names of pictures on a page. (ex: Picture 1 - This is picture 1 Picture 2 - This is picture 2. ) The pictures are uploaded to the database using a form. If someone clicks the above titles, the user should be directed to a page containing the picture (ex: www.example.com/picture1. I am wondering how I go about this, and how to make susck titles appear as links. Sorry I sound very naiive, but I've only recently started with PHP(been 3 days)
View Replies !
View Related
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 !
View Related
Accessing A Website's Title
Is there any way we can access the title of a web page through php? This is how I want it work: 1. User inputs webpage address in a form. 2. My website should display the title of the inputted website(as in, 'www.google.com' has a title of 'Google - Home'). Any ideas?
View Replies !
View Related
How Would I Read The Media:title Tag?
The DOM is easy enough to use if you have xml for example: <tag> <tag2>info</tag2> <tag3>Info</tag3> </tag> etc But... what if we have something like this: <item> <media:title>Title Here</title> </item> How would i read the media:title tag? using getElementsByTagName ( "media:title" ); does nothing!
View Replies !
View Related
Reading HTML Title In PHP
I am challenged with the task of writing a PHP script that will prompt the user for a website (ex: yahoo.com). When submitted, the PHP script will somehow open the web page as a file, somehow search the source, find the <title> tag, and return the title of the web page.. If someone knows an easier approach to this, I would appreciate it. Opening an entire website as a variable seems like a bit of overkill.. Heres where I'm at so far, I'm kind of looking for a push in the right direction. I've been googling for awhile now trying to find out how to tackle this, but searching for things like "php, website, title, web page, HTML" hasn't proved too successful.. <?php // Assigns $site from the form text box named "site" // $site = $_POST['site']; $file = fopen($site, "r"); // This needs to open the text-source of the inputted webpage. // From here I will search for the <title> tag in the HTML... // echo "$file"; echo "<br><hr>"; ?>
View Replies !
View Related
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 !
View Related
PHP -> Xajax -> Dynamic Title Tag?
The main xajax coding is there (not uploaded yet its all in the HTML version right now) and in the HTML version i have a new TITLE tag for each html like Home-Button -> Index.html -> <title>Norcaineassansi:: Index</title> now, since i want to change to xajax, i dont need to load a complete file anymore (also i am converting the sites to PHP!) just laoding the div where the new stuff will be if you click on a button... but that'll stuck me on ONE! Title tag which i couldnt dynamicly modify as of yet and i would like to define a new title tag for each button even tho i dont load a new site like it is in the HTML version.
View Replies !
View Related
Order By Downloads/title
how do I make "Order by Downloads/Title/Date" for my download script? My script: if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { echo ('<tr>'); echo ('<td valign="top"><a href="screenshots/'.$row["screenshot"].'.jpg"><img src="screenshots/'.$row["screenshot"].'thumb.jpg" border="0" /></a></td>'); echo ('<td width="100%" valign="top"><div class="title">'.$row["title"].'</div>'); echo ('Author: '.$row["author"].'<br />'); echo ('Description: '.$row["description"].'<br />'); echo ('<br /><br />'); echo ('<a href="download.php?file='.$row["filename"].'.zip" class="menuitem">Download</a> ('.$row["downloads"].' Downloads)'); echo ('</td>'); echo ('</tr>'); }
View Replies !
View Related
Automated Browser Title
Something that would be really useful for a new project im working on would be to have automated browser titles using some php code in the <title> tags. The only way I can think of doing this is by having the php code read the url im using for navigation, e.g. /windows/atari2600/ and use that data, edit it and have it display as 'Windows > Atari 2600' . Has this kind of thing been done before? are there any other common ways of doing this? Also are there any tutorials around?
View Replies !
View Related
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 !
View Related
Echoing The Document Title
I am trying to create a document template, which is easily adaptable to allow insertion of pages quickly and easliy. This template used to use javascript, and I am now trying to convert it to php. One issue I have is that the page title eg <title>My Title</title> is used as the page title, but it is also displayed in <h1> tags on the top of the page too. Using javascript, this was easy document.write("<h1>document.title</h1>");. Is there a way to do this with PHP, so that the end user is unaware that this text has been generated dynamically.
View Replies !
View Related
Adding Title Tag Fails
Not sure if this will require php code or html It is to be used on a php page. I have the following and i want to add a title to it: $Language['index']['gettingstarted] = " <br><b>M&D Free Treasure</b><br> M&D is a free <a href='index.php'>Treasure Map</a> set up by a few close friends"; This currntly works but when i add a title it fails anyone know the correct way to do it please? within HTL this works but when i add it to my php page it fails: $Language['index']['gettingstarted] = "<a href="login.php" title="Free Treasure>Free Treasure here</a>";
View Replies !
View Related
Webpage Title As UTF String
I'm stuck with a silly problem here. I'm trying to fetch a webpage and parse its HTML title. It works fine for Western charset pages, but if I try to fetch a non-English (say Japanese) webpage then the returned page title is not well encoded (although the source webpage is UTF8 encoded). Here's the basic code I have (using Google News Japan as an example to print its webpage title): Code: $pagetext = file_get_contents("http://news.google.com/news?ned=jp"); preg_match("/<title>(.*?)</title>/is", $pagetext, $pagefound); echo $pagefound[1]; Further, I store the the webpage title in the database (in a UTF8 table with a UTF8 charset field). But the printed or stored value is not well encoded and has invalid chars like?
View Replies !
View Related
Attached Many ID's To One Title
I have often wondered how big sites like imdb.com are made. How do they make a database with all these actors link to a movie. When you find a movie it has maybe 50 people attached to this movie. I geuss they don't have a database with Movie title, Actor1, Actors2, Actors3. Actor49 and Actor50 with and id (connected to there name in another base) written in all of them. I geuss they have a movie database and an actor database, but how do they code it so any amount from 1 - 100 people are written when you find a movie.
View Replies !
View Related
|