Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter
Powered by Vanilla. Made with Bootstrap.
Theme built by Kasper Kronborg Isager
page title
  • hey Fabian, how are you?
    i have a question that i hope you can help me with :
    I want to create a different page title (meta tag) for each page than the title given for it on the menu when creating the page.
    fo example : page no' 1 is titled HOME in the menu, but i want the meta tag title to say 'welcome to my website'
    is it posiible when working with dinamic pages/menu?
    if so, how?
    thanks,
    ofer
  • hi,

    good question :)
    actually no its not the only, way would be to write the meta tags manually.
    this means you could use for example the description fo the page and add it as the title. but then you cant use the createMetaTags method and you have to add these meta tags by hand.

    adding this manually would look something like this
    <?php
     
    ...
     
    $currentPage = $feindura->showPage();
     
    ?>
    <head>
    <?php
     
    echo '<title>'.$currentPage['description'].'</title>';
     
    ?>
    ...
    </head>


    hope that helps.
  • actualy im talking about different title for each page.
    so if i understand right i should specify the pages ID on the showpage(1);
    but if i do so i need to modify the index page after creating new pages.
    did i understand tou right?
  • no no,

    when you call showPage without a parameter, then it uses always the paramter of the current page, means each page, so you dont have to write anything else.
    you then just put the other page title into the description field of the page...
  • so to change the title for lets say page id 3, i need to write :
    echo '<title>'.$currentPage['3'description].'</title>';

    ?
    does it take the description of the page or do i need to enter the title where it says description?
  • not quite,

    to show the title (description) for page with ID 3, you need write like this:
    <?php
     
    ...
     
    $currentPage = $feindura->showPage(3);
     
    ?>
    <head>
    <?php
     
    echo '<title>'.$currentPage['description'].'</title>';
     
    ?>
    ...
    </head>


    and the second yes: you don't have to write it into the description field :)
  • so this comes back to what i wrote earlyer.. if i want to change all the titles for all the pages i have to do this ? :
    <?php
    $currentPage = $feindura->showPage(1);
    ?>
    <head>
    <?php
    echo '<title>'.$currentPage[''description].'</title>';
    ?>
    </head>
     
    <?php
    $currentPage = $feindura->showPage(2);
    ?>
    <head>
    <?php
    echo '<title>'.$currentPage[''description].'</title>';
    ?>
    </head>
     
    <?php
    $currentPage = $feindura->showPage(3);
    ?>
    <head>
    <?php
    echo '<title>'.$currentPage[''description].'</title>';
    ?>
    </head>
    .
    .
    .

    and so on..?
  • no, if you want to change all the titles for all pages just leave the parameter blank showPage().

    if you want to change only specific ones, put a parameter...

    by the way, i made a mistake is must be $currentPage['description'] not $currentPage[''description]
  • ok. only now i understand :) im not to bright, sorry :-/
    by the way, im having trouble with the pretty url. deleting the htaccess will solve it?
    thanks a million
  • yeah, if you have problems with pretty urls, then deleting the .htaccess file in the websites root will deactivate the pretty urls..
  • hey, going back to the title subject.
    what i have now is a problame with seo.
    doing this method of :

    $currentPage['description']

    changes the visible title on the pages window tab but doesnt show up as a page title, which means google doesnt realy take any notice of it.
    what i need is a manual way to change every page title (without using the description method), so when i view the page's source i can see a different meta tag for each page.
    possible?
  • this is absolutely possible, like i wrote.

    with the showPage() method you get an array with data for the current page back, how you implement that into your websites (as meta tag or what ever) is completely up to you.

    if the title shows up in the tab, but not in google, then there is something else wrong.
    sadly i dont have the time to give a basic course in html or SEO :)

    the best is you check out a tutorial or blog post, which explains how to write good meta tags and then you can just fill them in with what you get in the $currentPage array.
  • thanks.
    I have knowledge of Seo but I was not able to make a custom title show on the page with this method.
    Could you please write me what would be the correct code?
  • the first code i wrote you was the right one.
    <?php
     
    require('cms/feindura.include.php');
    $feindura = new Feindura();
     
    // leave the id parameter blank, so it will always use the current page, which is selected
    $currentPage = $feindura->showPage();
     
    // to see how the keywords and the content of this array are, use this way
    DebugTools::dump($currentPage);
     
    ?>
    <head>
    <?php
     
    // then we add the description of the current page as the title
    echo '<title>'.$currentPage['description'].'</title>';
    // then we have to create all the other seo necessary meta tags
    echo '<meta name="keywords" content="'.$currentPage['keywords'].'">';
    etc....
     
    ?>
    // here you put in your other header html tags
    </head>
    // here begins the rest of your website

    if you write your website as a single page, you can't repeat the head tag mutiple times, like you did in your example. this will for sure confuse every google bot.
    you only write the head ones, like in the example above. then you can show the content, like you do already...

    by the way, if you have a single page design, then you probably have to switch the title and meta tags, with javascript, when you click a link..
  • thanks.
    maybe i confused you.
    it is not a single page.
    i dont want to use the description as a title but i want to write a manual title. is it possible?
    something like this?
    $currentPage = $feindura->showPage(1);
    echo '<title>'.$currentPage['THIS IS THE PAGE 1 TITLE].'</title>';


    as i mentioned, the code you have given me works, but when you view the page source you dont see a TITLE in the HTML markup, that means that google cant see it as a title. am i wronge?
    thanks for your time, sorry if im driving you crazy :)

    update :
    i found out how to do what i want but it still doesnt show as title in the html.
    this is what used :
     <?php
    $currentPage = $feindura->showPage();
     
    echo $currentPage['content'];
    ?>
    <head>
     
    <?php
    if($feindura->page == 1 ) {
    echo '<title>עו"ד רועי אחיעזר - עו"ד בינלאומי מומחה לדיני חברות</title>';
    }
    if($feindura->page == 2 ) {
    echo '<title>עו"ד רועי אחיעזר - אודות</title>';
    }
    ?>
  • cant belive the mistake i made !!! :))
    i didnt put the

    $currentPage = $feindura->showPage();
    echo '<title>'.$currentPage['description'].'</title>';

    in the head section, i placed it in the body with tags LOL.
    that was my problem all the time.
    sorry and thank you :)>-
  • :)

    oho,

    glad that you figured it out.