$10 to the one that can help me - PHP

Discussion in 'Services' started by login, Oct 8, 2007.

  1. #1
    I have a recipe site where I have recipe names in H1 tags on the recipe pages. For SEO reasons I need that recipe keywords in the H1 tag to show up in the meta title and the meta description tag. I am very php challenged and will pay $10 to the one that can lead me through this problem. Its a template driven site/script.
     
    login, Oct 8, 2007 IP
  2. bordello

    bordello Notable Member

    Messages:
    3,204
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    290
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    No Need Of Paying Simply Put Your Text In This Format

    [​IMG]

    Thanks :)
     
    bordello, Oct 8, 2007 IP
  3. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    Thanks bordello, a good answer, but that answer belongs to another question :D
    I need to copy the text of the H1 tag on one page into the desc and title meta tags on the same page.

    Anyone?
     
    login, Oct 8, 2007 IP
  4. RRWH

    RRWH Active Member

    Messages:
    821
    Likes Received:
    49
    Best Answers:
    0
    Trophy Points:
    70
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    Ok, where does the text that is in the H1 tags come from? is it hard-coded?

    what does your template look like? how does the content get put into your template?

    There are literally a hundred different answers to your question but insufficient info to be able to provide one that will work.
     
    RRWH, Oct 8, 2007 IP
  5. hextraordinary

    hextraordinary Well-Known Member

    Messages:
    2,171
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    105
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    This is correct, the most important part is, Where the info in side the H1 tags come from?
     
    hextraordinary, Oct 8, 2007 IP
  6. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #6
    The info in the H1 tag is coming from a data base of recipes. And the title and description meta tags showed on a recipe page are coming from a template page called include.php witch is used in every page on the site.
     
    login, Oct 8, 2007 IP
  7. hextraordinary

    hextraordinary Well-Known Member

    Messages:
    2,171
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    105
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    So all you need to do is check in the code what is the name of the variable or individual array property that gets into the H1 titles, and insert the same variable in your meta description tag.
     
    hextraordinary, Oct 8, 2007 IP
  8. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    That is my problem.
    This is the code that makes the H1:
    <h1><?php echo $row_recipe["name"];?> - oppskrift</h1>

    If I put this in the
    <title><?php echo $site_title; ?></title> in the iclude.php file, the recipe name will not show in the title meta tag.
     
    login, Oct 8, 2007 IP
  9. hextraordinary

    hextraordinary Well-Known Member

    Messages:
    2,171
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    105
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    This is either an old or bad code... anyway... thats probably because include.php doesnt know what $row_recipe["name"], you should check where the $row_recipe query comes from and either include it or copy it into include.php
     
    hextraordinary, Oct 8, 2007 IP
  10. NoobieDoobieDo

    NoobieDoobieDo Peon

    Messages:
    1,456
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #10
    The php file in question calls include.php in its head. Include.php renders the header (title + meta) for the page. There for the header is rendered before the variable in question has a value (this variable isn't defined until later in the file that calls include.php).

    I tried placing the contents on incude.php into the header of the file in question so the variable would be defined when it was referenced but this didn't work for unknown reasons.

    Good luck
     
    NoobieDoobieDo, Oct 8, 2007 IP
  11. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #11
    Thanks, looks like I need it :) What do you mean hextraordinary, "This is either an old or bad code." Would it not work if it is an old code?
     
    login, Oct 8, 2007 IP
  12. NoobieDoobieDo

    NoobieDoobieDo Peon

    Messages:
    1,456
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #12

    I included that function after the DB connect but before the include.php functions get ran. Even when the code from include.php is INSIDE the other PHP file and preceded by the function that defines $row_recipe trying to echo the variable fails for the title and meta but still works for the h1.

    It was something like this

    file.php
    _____
    include("thumbnail.php");
    include("include.php");
    ...
    function that gets $row_recipe
    ...
    echo of $row_recipe into h1
    ..(other stuff)
    _____

    includes.php
    _____
    connect to db
    ..
    make meta
    ..
    make title
    ..(other stuff)
    _____


    So I did it like this

    new.php
    _____
    include("thumbnail.php");
    connect to db
    function that gets $row_recipe
    ..
    make meta + $row_recipe
    ..(other includes.php stuff)..
    make title + $row_recipe
    ..
    echo of $row_recipe into h1
    ..
    ..(rest of file.php)
    _____

    But when I do this $row_recipe is only echo'd the last time and not the first two times. The first two times it has a null value (?). If I check the source of the output file the meta is like <meta name="description" content=" ">. Where the space in " " should be the same $row_recipe echoed later in the document.
     
    NoobieDoobieDo, Oct 8, 2007 IP
  13. odin93

    odin93 Active Member

    Messages:
    739
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #13
    Ye i tried it, that also happened to me its very wierd code.
     
    odin93, Oct 8, 2007 IP
  14. NoobieDoobieDo

    NoobieDoobieDo Peon

    Messages:
    1,456
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #14
    Yes, yes it is. I went through that song and dance about 10 times and always ended up with unexpected results.
     
    NoobieDoobieDo, Oct 8, 2007 IP
  15. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #15
    Thanks for trying. Damn, I need those H1 keywords in the title and desc. I cannot use the script if I cant do that. Is there a way to rebuild the script then?
     
    login, Oct 8, 2007 IP
  16. bordello

    bordello Notable Member

    Messages:
    3,204
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    290
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #16
    Add Me In My Yahoo,I Can Help U

    thanks
     
    bordello, Oct 8, 2007 IP
  17. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #17
    I wish I had Yahoo IM, or any IM :eek:. I have to go soon and will be away for 36 hours.
     
    login, Oct 9, 2007 IP
  18. hextraordinary

    hextraordinary Well-Known Member

    Messages:
    2,171
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    105
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #18
    Where's the code that your talking about, I can take a look and make it work for you ... damn I love challenges :D
     
    hextraordinary, Oct 9, 2007 IP
  19. RRWH

    RRWH Active Member

    Messages:
    821
    Likes Received:
    49
    Best Answers:
    0
    Trophy Points:
    70
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #19
    sounds reasonably easy to sort out - drop ne a copy of your script and I'll see what I can come up with...
     
    RRWH, Oct 9, 2007 IP