SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I would like to add my own text to each of these footer_links

    I would like to add my own text to each of these footer_links

    my site has categories, and each of these categories are displayed at the bottom of the main page in the footer.

    http://trade-th.com/

    eg: Vehicles | Cars | Motorcycles

    I would like to add "My Text" in front each of these footer links, can it be done ? ("My Text" are the same words in all cases)

    My Text Vehicles | My Text Cars | My Text Motorcycles

    from the int.php file I have the code:

    $footer_links=$categ->makeFooterLinks();

    and

    $smarty->assign("footer_links",$footer_links);

    I am not sure if this code helps.

    All help greatly appreciated

  2. #2
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,397
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by RayWilk View Post
    from the int.php file I have the code:

    $footer_links=$categ->makeFooterLinks();

    and

    $smarty->assign("footer_links",$footer_links);
    Hi Ray,

    From your previous thread, it seems that $footer_links contains all the text and HTML as a single string, which would be difficult to work with. Do you know where the makeFooterLinks() method is defined? Probably your best bet is to alter that, to add your custom text to each link as it generates the string.

  3. #3
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi fretburner, thank you for your reply I did a search for makeFooterLinks() in every file used in my site and only one result - util.php

    So the words makeFooterLinks() appear in only one file the util.php

    The code in that util.php is:

    // footer categories links
    if($appearance_settings['show_footer_categ']==1) {

    global $config_footer_categ_len;

    $footer_links=$categ->makeFooterLinks();
    $smarty->assign("footer_links",$footer_links);
    }

    Please point me in the right direction if you need more info/code,

    Your help greatly appreciated

  4. #4
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,397
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    In the util.php file, have a look for where $categ is defined.. you should see something like this:

    PHP Code:
    $categ = new ... 
    makeFooterLinks is a method on a class somewhere - if you can find out the name of the class, you can look for the class file and that's probably where you'll find the code for makeFooterLinks.

  5. #5
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi fretburner, good to hear from you, thank you

    ok yes in the same util.php file I found:

    global $short_categories;
    $categ = new categories();
    $short_categories=$categ->getAllOptions();
    $smarty->assign("categories",$short_categories);

    I am happy to PM you the complete util.php file if that would help,

    I may not reply till tomorrow now as evening/dinner time here

  6. #6
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi fretburner, good to hear from you, thank you

    ok yes in the same util.php file I found:

    global $short_categories;
    $categ = new categories();
    $short_categories=$categ->getAllOptions();
    $smarty->assign("categories",$short_categories);

    does this help ?

  7. #7
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,397
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Hey Ray,

    Try looking for the file with the categories class definition.. try looking for a folder called classes and see if there's a categories.php file inside.

  8. #8
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi fretburner, thank you for your reply yes found the folder called classes, and the categories.php, and here is the code:

    <?php //0035e
    if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='/ioncube/ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}@dl($__ln);}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file <b>'.__FILE__.'</b> requires the ionCube PHP Loader '.basename($__ln).' to be installed by the site administrator.');exit(199);
    ?>
    4+oV52OVZIpYf7K3x+eO3pKstjNlNOeat9eIykKs+vVxjHlI0veWtUZhRLyYXKJMim1hXCPiL+yM

  9. #9
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi fretburner, thank you for your reply yes found the folder called classes, and the categories.php, and here is the code:

    <?php //0035e
    if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='/ioncube/ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}@dl($__ln);}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file <b>'.__FILE__.'</b> requires the ionCube PHP Loader '.basename($__ln).' to be installed by the site administrator.');exit(199);
    ?>
    4+oV52OVZIpYf7K3x+eO3pKstjNlNOeat9eIykKs+vVxjHlI0veWtUZhRLyYXKJMim1hXCPiL+yM

  10. #10
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,397
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Hmm, the file has been encoded with ionCube, which is basically to stop people being able to read or modify the code, so there's not much we can do here. The only option it leaves us is to try and modify the output from makeFooterLinks.

    In utils.php, try doing this:
    PHP Code:
    $footer_links $categ->makeFooterLinks();
    $footer_links str_replace('">''">My Text '$footer_links);
    $smarty->assign("footer_links",$footer_links); 
    This should prepend 'My Text ' to the text of each of the links.

  11. #11
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi fretburner, thank you for your reply, and THANK YOU for the perfect code! yes that prepends text to each link

    I am not sure I like the result visually as the links now all align to the left, if you look at http://trade-th.com/

    Is there any code that could tidy these links ?

    your help greatly appreciated

  12. #12
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi fretburner, I have improved the link layout by adding the <center> code, what else can be done ?

    <h3 id="footer_categories"><center>{$footer_links}</center></h3>

    your help greatly appreciated

  13. #13
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,397
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Hey Ray,

    Quote Originally Posted by RayWilk View Post
    Hi fretburner, I have improved the link layout by adding the <center> code, what else can be done ?

    <h3 id="footer_categories"><center>{$footer_links}</center></h3>

    your help greatly appreciated
    The $footer_links string has line breaks hard coded in, and now that you're prepending some text to each link the lines are longer and look odd when they wrap. You might want to try this and see if you prefer the look:

    PHP Code:
    $footer_links $categ->makeFooterLinks();
    $footer_links str_replace('">''">My Text '$footer_links);
    $footer_links str_replace('<br />'' | '$footer_links);
    $smarty->assign("footer_links",$footer_links); 
    I would avoid using the <center> tag, as it's a depreciated tag, and it's better to use CSS to center text. It's also better not to wrap the footer links in a <h3> tag, as it's not a heading and I'm guessing you're doing it for styling purposes, in which case again it's better to use CSS.

    HTML Code:
    <div id="footer_categories">{$footer_links}</div>
    and in your css file:

    Code CSS:
    #footer_categories {
        color: rgb(77, 80, 89);
        margin-top: 10px;
        line-height: 17px;
        /* add the lines below */
        padding: 0px 50px;
        font-size: 120%;
        font-family: "Trebuchet MS",verdana,arial,sans-serif;
        font-weight: bold;
    }

    You'll probably want to play around with the padding to get it looking the way you want.

  14. #14
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi fretburner, Thank you Thank you all your generous, and greatly appreciated code implemented and looking great

    I changed the footer links to h4 <h4 id="footer_categories">{$footer_links}</h4>

    As the purpose of this exercise was to add an h2 to my page, and add prepending text to the footer links, all for SEO purposes, hoping it will help

    {if $appearance.show_footer_categ}
    <h2 style="font-size:14px;color:#4D5059;"><center><b>My Text</b></center></h2>
    <h4 id="footer_categories">{$footer_links}</h4>
    <!-- end: #footer_categories -->

    Thank you again fretburner for your brilliant generosity


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
  •