I need help with a description variable problem

Discussion in 'PHP' started by USWGO, Feb 2, 2010.

  1. #1
    No need to know the script I need help with because all this is is a meta description problem although if you really want to know it's a Veppa Free wallpaper script.

    Anyways it's a simple wallpaper script which I am modding as much as I can because most of the good ones cost a fortune and can't really afford my own programmer as many do besides if hacker vulnerabilities are found I'm forced to pay more good money which I don't have with the economical problems.

    Anyways first I will bring out the names of two variables
    
    <?=Config::option('site_title')?>
    Code (markup):
    stands for the sites title

    but when I goto my wallpaper pages the title stays the same and will not change the titles to have my wallpaper name then my sites name and I tried to work with that but am having trouble with having the titles only change when I goto a wallpaper download page.
    
    <?=Config::escape($wallpaper->name)?>
    Code (markup):
    is the wallpaper name but when it it empty it shows '' and really bugs me that I can't get the titles all right.

    To make it more SEO Friendly I am looking for somebody to give me advice on a short code on a variable like this example:

    php? if there is a wallpaper name then show wallpaper name instead of the usual site title

    like that.

    Same with description. It's bad for SEO, user friendlyness, and makes it difficult for people to find pages on my site when the description stays the same for every page even though each wallpaper has a different description.

    like again with the other php code variable I want:

    php? if the wallpaper page has a description then show that instead of the regular site admin description and if the wallpaper description is missing (like non existent) then it will revert to the sites description.

    I need a php script like this.

    Sites title:<?=Config::option('site_title')?> or site_title
    Sites description: <?=Config::option('site_description')?> or site_description
    Wallpapers title/name: <?=Config::escape($wallpaper->name)?> or $wallpaper->name
    wallpapers description: <?=Config::escape($wallpaper->description)?> or $wallpaper->description
    Code (markup):
     
    USWGO, Feb 2, 2010 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,903
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #2
    are you just looking for
    Sites title:<?php echo empty(Config::option('site_title'))? $site_title: Config::option('site_title'); ?>
    PHP:
     
    sarahk, Feb 3, 2010 IP
  3. USWGO

    USWGO Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    the code looks good to me. I will use it and if it works I will add to your reputation and thank you personally. I need to start being more thankful for people that help me for free even though I give free stuff too being thankful is always a good thing :)
     
    USWGO, Feb 3, 2010 IP
  4. USWGO

    USWGO Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    When I tried to put in the code and change the one area to wallpaper name it blanked the whole site. I may try to show php errors but I am not sure why it is doing it.

    I will show you the error code when I get it.
     
    USWGO, Feb 3, 2010 IP
  5. sarahk

    sarahk iTamer Staff

    Messages:
    28,903
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #5
    I missed a bit, try this
    Sites title:<?php echo (empty(Config::option('site_title')))? $site_title: Config::option('site_title'); ?>
    PHP:
     
    sarahk, Feb 3, 2010 IP
  6. USWGO

    USWGO Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    im sorry but it still won't show. I tried e_all to try to get the errors to show and it won't show anything.

    I don't understand why this keeps happening.

    I wish that script would have a title changer like adds the wallpaper name to the title.
     
    USWGO, Feb 3, 2010 IP
  7. sarahk

    sarahk iTamer Staff

    Messages:
    28,903
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #7
    I would say there's nothing in the variable.

    what happens if you put this in?
    var_dump(Config::option('site_title'));
    echo '<hr>';
    var_dump($site_title);
    echo '<hr>';
    PHP:
     
    sarahk, Feb 3, 2010 IP
  8. USWGO

    USWGO Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    it does show the title. I think I know what the problem is. The person that has written the script set the header for all the script so the entire site displays the site title variable but in the main area there is no wallpaper name but in certain areas the wallpaper name does exist.

    This is what I am really looking for.

    in the main area:

    Site title for wallpaper site

    then in wallpaper area:

    Wallpaper 1 - Site title for wallpaper site

    Wallpaper 2 - Site title for wallpaper site

    example name bird wallpaper - Site title for wallpaper site

    What I really need is a simple php code that will input the wallpaper name in certain areas.

    All wallpapers and downloads are I think in a mod rewrite generated /wallpaper directory.

    I hope this helps you know what exactly I needed help with.
     
    USWGO, Feb 3, 2010 IP
  9. sarahk

    sarahk iTamer Staff

    Messages:
    28,903
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #9
    So long as your site is using a decent coding practice and working things out in a decent order we can manage something.

    Each script should have the opportunity to generate $alt_title

    And then you just test to see if $alt_title is null, empty or whatever. If it is, then use site_title.

    The big gotcha is that the page has to have all the database calls done before you start generating the page - which is appropriate and good practice but not guaranteed.
     
    sarahk, Feb 3, 2010 IP
  10. USWGO

    USWGO Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    it ain't like your usual wordpress or phpbb script but it is a free wallpaer script. If you have found a solution for Veppa free wallpaper script then please tell me.

    I could also contact him but if it's not being recently maintained then I doubt he will even help me with this title problem.
     
    USWGO, Feb 4, 2010 IP