Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37

Thread: <title></title> location

  1. #1
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default <title></title> location

    Hello,

    1) Is it possible to move the <title></title> out side of the <head> </head>?

    2) Is it possible to change your title on every page of your site with one file without changing it on every page?

    Please and thank you!

  2. #2
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    1. its possible, but it won't work and will probably end up in error.

    2. yes, if you want i can try to make it.(are your files .php , or .htm and .html)
    Last edited by Master_script_maker; 01-02-2008 at 08:45 PM.
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@ /\/\@|{
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  3. #3
    Join Date
    Dec 2007
    Location
    Ankara, Turkey
    Posts
    160
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default

    Hello,

    1) No.

    2) Yes, if you use a server side scripting system. Or if you just want this to be observable by the users(not the search engines) you can change the document.title property form JavaScript.

  4. #4
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, can you try to make it please! Thank you!

  5. #5
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    save it as rename.php, upload it to your server, and run it. It will go through all your folders.
    Edit: Changed file_put_contents to fwrite for compatablity issuses

    Edit: Must have 777 file permisions

    PHP Code:
    <?php
    function getdir($dir) {
        
    $title="";//edit this to what you want the title to be
        
    if ($handle opendir($dir)) {
            while (
    false !== ($file readdir($handle))) {
                if (
    $file=='rename.php'||$file=='..'||$file=='.') { 
                } else {
                    if (
    strpos($file'.html',1)||strpos($file'.htm',1)) {
                        
    $file_content preg_replace('/<title>(.*?)<\/title>/''<title>'.$title.'</title>'file_get_contents($dir.$file));
                        
    fwrite($dir.$file$file_content);
                    }    
                    if (
    is_dir($dir.$file)) {
                        
    $dirs[]=$file;
                    }
                }
            }
            
    closedir($handle);
        }
        for(
    $i=0;$i<count($dirs);$i=$i+1) {
            
    getdir($dir.$dirs[$i].'/');
        }
    }
    getdir('./');
    ?>
    Last edited by Master_script_maker; 01-06-2008 at 10:06 PM.
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@ /\/\@|{
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  6. #6
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot. Can you briefly explain how it works please? Thank you!

  7. #7
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,626
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    I really wonder why you want to change the position of title tag?

  8. #8
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by codeexploiter View Post
    I really wonder why you want to change the position of title tag?
    probably to be able to edit it with javascript.
    Quote Originally Posted by afe View Post
    Thanks a lot. Can you briefly explain how it works please? Thank you!
    sure.

    PHP Code:
    if ($handle opendir($dir)) { 
    if the folder is openable and you can set it to a variable, set it to "$handle" and open it

    PHP Code:
     while (false !== ($file readdir($handle))) { 
    while there are files not read, set one of their names to a variable($file)

    PHP Code:
    if ($file=='rename.php'||$file=='..'||$file=='.') {
    } else { 
    if the file is this one, or a folder above this one do nothing, if it is not continue.

    PHP Code:
    if (strpos($file'.html',1)||strpos($file'.htm',1)) { 
    if the filename contains '.html' or '.htm', continue

    PHP Code:
    $file_content preg_replace('/<title>(.*?)<\/title>/''<title>'.$title.'</title>'file_get_contents($dir.$file));
                        
    file_put_contents($dir.$file$file_content); 
    replace '<title>somethiing</title>' with '<title>your title</title>' from the contents of the file(The '$dir' is the path). then it saves the file.

    PHP Code:
    if (is_dir($dir.$file)) {
                        
    $dirs[]=$file;
                    } 
    if the 'file' is a folder add it to an array of folders.

    PHP Code:
    closedir($handle); 
    close the opened folder

    PHP Code:
    for($i=0;$i<count($dirs);$i=$i+1) {
            
    getdir($dir.$dirs[$i].'/');
        } 
    for each folder, run the function again with that one

    PHP Code:
    getdir('./'); 
    run the function in the current folder
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@ /\/\@|{
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  9. #9
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Does it matter what my page extention is? Mine is .php

  10. #10
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    if you want php change this:
    PHP Code:
    if (strpos($file'.html',1)||strpos($file'.htm',1)) { 
    to this:
    PHP Code:
    if (strpos($file'.html',1)||strpos($file'.htm',1)||strpos($file'.php',1)) { 
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@ /\/\@|{
    There are 10 kinds of people in the world, those that understand binary and those that don't.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •