Title, keywords with php includes?

Discussion in 'Search Engine Optimization' started by joshtb, Nov 27, 2006.

  1. #1
    Hi there,

    I've been reading for a while and have been trying to optimize my site in order to bring in better traffic. Aren't we all? ;)

    My site runs off of one index.php, as in, all the pages that I have on my site only contain content. (but the layout still appears) Does that make sense? Sorry if it doesn't, but it's hard to explain. Anyway, in the index.php file I have the title and keywords. Now, this means all of my pages will have the same title and keywords.

    So I can't change the title and keywords on all the other pages. Does anyone know how I could fix this?

    Also, sorry if this isn't the right forum for this. I felt it was as it has to do with title/keywords.
     
    joshtb, Nov 27, 2006 IP
  2. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You could use variables in those tags, using article titles to populate the title tag and maybe article title + category at sitename.com for the description. I'd scrap the keywords idea as that would be difficult without entering those on a per article basis or parsing the text and pulling the most used words minus any stop words... too much trouble for something that doesn't carry much SE weight IMO.
     
    mdvaldosta, Nov 27, 2006 IP
  3. joshtb

    joshtb Active Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Is there a way I could be able to change the title and keywords for each page? I read that it's best to do so so that they are related to what would be on that individual page.
     
    joshtb, Nov 27, 2006 IP
  4. Anghus

    Anghus Peon

    Messages:
    510
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Which CMS system are you using?
     
    Anghus, Nov 27, 2006 IP
  5. joshtb

    joshtb Active Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #5
    No CMS. I edit everything manually. Here's my code for the index so you may figure out what I'm talking about.

    It displays the news on my main page, and on every other page, the content. I been using this way for years, I don't know if there's a better way to do it now that would be a solution to my above predicament.
     
    joshtb, Nov 27, 2006 IP
  6. hhheng

    hhheng Banned

    Messages:
    2,633
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Why you can't edit the title and keyword tags? What software you are using to edit your php files? This is very strange. In DM, it's very easy to change the title and keyword/description tag for asp/php/aspx, etc files.
     
    hhheng, Nov 27, 2006 IP
  7. joshtb

    joshtb Active Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #7
    Well no, I can. I use notepad and I edit the index file to update the keywords and such. But I want to be able to change the keywords and title for each page. But I can't do that because all the content pages run off of what's in the index.php.
     
    joshtb, Nov 27, 2006 IP
  8. Anghus

    Anghus Peon

    Messages:
    510
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I'm not sure about this, since I'm not a programmer, but i believe that it is possible to build a modul similar as to wordpress. I'm sorry, thats the only thing I can help you with.
     
    Anghus, Nov 27, 2006 IP
  9. kkibak

    kkibak Peon

    Messages:
    1,083
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Okay it looks to me like since you are actually including the $page.php file, these must exist on your server? Or are you doing a mod rewrite or something?

    This should be fairly easy to get working right--just need a little more info.
     
    kkibak, Nov 27, 2006 IP
  10. joshtb

    joshtb Active Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #10
    The $page.php files are what the files are. For example, if I had a staff page it would be staff.php and be viewable through the url: index.php?page=staff.
     
    joshtb, Nov 28, 2006 IP
  11. joshtb

    joshtb Active Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #11
    Just bumping in hopes that someone knows what I'm talking about. :x
     
    joshtb, Nov 28, 2006 IP
  12. JosS

    JosS Guest

    Messages:
    369
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #12
    <title><?php echo $title ?></title>

    put that in your page.php


    Now before including the layout file, do this
    $title = "Page Title for specific page";
    include('page.php');
     
    JosS, Nov 28, 2006 IP
  13. joshtb

    joshtb Active Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #13
    I changed it to look like this:

    I didn't add the suggested includes on page.php because it's already in there. As far as the title code in page.php, there is no page.php. All the pages are whatever.php, so I put that code in all those. However, how would this help me change the title to be different on every page?

    I'm a bit lost.
     
    joshtb, Nov 28, 2006 IP
  14. joshtb

    joshtb Active Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #14
    Sorry to bump again, but I really need to find a resolution...
     
    joshtb, Nov 29, 2006 IP
  15. Bondat

    Bondat Peon

    Messages:
    2,397
    Likes Received:
    217
    Best Answers:
    0
    Trophy Points:
    0
    #15
    I believe you have to create a script for that. I've handled few clients that have paid for a programmer to make his site SEO friendly by automatically changing the title, description and URL. BTW he's using xoops if you want to know what CMS that made it possible.
     
    Bondat, Nov 29, 2006 IP
  16. telandweb

    telandweb Member

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #16
    I believe that the solution for your problem will be by adding an extra camp on every page. Let me explain.

    On page.php at the very top add
    $title = "YOUR TITLE";
    $descripcion = "YOUR DESCRIPTION";

    And like that for every page.

    Then after this,
    if(file_exists("$page.php"))

    Retrieve those variable information to show the title and description on your pages. As a read try to fix the layout to retrieve those value in order to show correctly.

    It is not the optimal solution for this, but in this case i think it will be most elegant way to fixed.
     
    telandweb, Nov 29, 2006 IP
  17. joshtb

    joshtb Active Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #17
    How would I do that?

    Forgive me as I am not too fluent in php.
     
    joshtb, Dec 5, 2006 IP
  18. dnahosting

    dnahosting Active Member

    Messages:
    385
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #18
    create a header include that has all the <html><head><title> etc in it to just before the <body> tag. put <title><?php echo $title ?></title> in the head etc and set the $title var in your page.php

    ?? maybe that will do it?
     
    dnahosting, Dec 5, 2006 IP
  19. joshtb

    joshtb Active Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #19
    But how do I set the $title variable?
     
    joshtb, Dec 5, 2006 IP
  20. draligus

    draligus Well-Known Member

    Messages:
    389
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    110
    #20
    if all pages have the same title , it causes your pagerank to decrease
     
    draligus, Dec 5, 2006 IP