SitePoint Sponsor

User Tag List

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

    How to add a h2 tag to this footer code ?

    How to add a h2 tag to this footer code ?

    I would like to add a h2 tag to my footer, below is part of my footer code, and what I have been trying to a add.

    {if $appearance.show_footer_categ}
    <div id="footer_categories">{$footer_links}</div>
    <!-- end: #footer_categories -->
    {/if}

    I have tried adding this: <center><h2> <font face="arial" color="FFFFFF" size="4">Text for the footer for my page</font></h2></center>

    or this: <h2>Text for the footer for my page</h2>

    {if $appearance.show_footer_categ}
    <div id="footer_categories">{$footer_links}</div>
    <h2>Text for the footer for my page</h2>
    <!-- end: #footer_categories -->
    {/if}

    the text appears in the footer, yet does not have a h2 tag to it.

    my site is: http://trade-th.com/ maybe that will help, as I have h1 and h3 tags already

    all help greatly appreciated

  2. #2
    SitePoint Guru bronze trophy
    Join Date
    Feb 2013
    Posts
    679
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php if ($appearance.show_footer_categ);    ?>
    <div id="footer_categories"><h2><?php echo $footer_links?></h2></div>
    <!-- end: #footer_categories -->
    <?php endif; ?>
    OR
    PHP Code:
    <?php
    if ($appearance.show_footer_categ);    
    echo 
    "<div id=\"footer_categories\"><h2>$footer_links</h2></div>\r";
    endif; 
    ?>
    OR
    PHP Code:
    <?php
    if ($appearance.show_footer_categ);    
    echo 
    '<div id="footer_categories"><h2>' $footer_links '</h2></div>';
    endif; 
    ?>
    OR
    PHP Code:
    <?php
    if ($appearance.show_footer_categ){    
    echo 
    '<div id="footer_categories"><h2>' $footer_links '</h2></div>';

    ?>
    OR
    PHP Code:
    <?php
    if (isset($appearance.show_footer_categ)){    
    echo 
    '<div id="footer_categories"><h2>' $footer_links '</h2></div>';

    ?>
    OR

  3. #3
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Drummin, thank you for your fast and many optioned reply

    Yet due to my lack of knowledge I can not get your code options to work.

    I replaced:

    {if $appearance.show_footer_categ}
    <div id="footer_categories">{$footer_links}</div>
    <!-- end: #footer_categories -->

    {/if}

    with your code options, eg:

    <?php
    if ($appearance.show_footer_categ);
    echo "<div id=\"footer_categories\"><h2>$footer_links</h2></div>\r";
    endif;
    ?>

    What am I doing wrong ?

    your help greatly appreciated

  4. #4
    SitePoint Guru bronze trophy
    Join Date
    Feb 2013
    Posts
    679
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    MY BAD.

    I hardly ever write endif; I always use brackets like the last two examples. Those first IF lines should end in a full colon.
    PHP Code:
    <?php
    if ($appearance.show_footer_categ):
    echo 
    "<div id=\"footer_categories\"><h2>$footer_links</h2></div>\r";
    endif;
    ?>

  5. #5
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Drummin, Thank you for your reply, and corection, but! still not working

    I replace:

    {if $appearance.show_footer_categ}
    <div id="footer_categories">{$footer_links}</div>
    <!-- end: #footer_categories -->

    {/if}

    with:

    <?php
    if ($appearance.show_footer_categ):
    echo "<div id=\"footer_categories\"><h2>$footer_links</h2></div>\r";
    endif;
    ?>

    help

  6. #6
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would also like to add a line of text to the footer:

    {if $appearance.show_footer_categ}
    <h2>Text for the footer of my page</h2>
    <div id="footer_categories">{$footer_links}</div>
    <!-- end: #footer_categories -->

    {/if}

  7. #7
    SitePoint Addict
    Join Date
    Aug 2006
    Location
    Nantwich, Cheshire
    Posts
    363
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    So the idea is to put a header across the top of the list of footer - links? I would think that would need to be inside the div, so it would be:

    Code:
    <div id="footer_categories"><h2>Footer title</h2>{$footer_links}</div>
    Then style it as you wish in the CSS.
    http://www.firenza.net - my homage to a car from the 1970s

  8. #8
    SitePoint Guru bronze trophy
    Join Date
    Feb 2013
    Posts
    679
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Well what is this?
    PHP Code:
    $appearance.show_footer_categ 
    I've not seen this type of code where a constant is joined to a variable or what is supposed to resolve to. true/false ?

    Maybe someone else in the forum would know.

  9. #9
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,389
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by Drummin View Post
    Well what is this?
    PHP Code:
    $appearance.show_footer_categ 
    I've not seen this type of code where a constant is joined to a variable or what is supposed to resolve to. true/false ?

    Maybe someone else in the forum would know.
    Looks like the OP is using the Smarty template system.

    @RayWilk: If you do something like this
    PHP Code:
    {if $appearance.show_footer_categ}
    <
    div id="footer_categories">
        <
    h2>Text for the footer for my page</h2>
        {
    $footer_links}
    </
    div>
    <!-- 
    end#footer_categories -->
    {/if} 
    then the text 'Text for the footer for my page' appears as soon as you refresh the page, but without the opening and closing H2 tags?

  10. #10
    SitePoint Guru bronze trophy
    Join Date
    Feb 2013
    Posts
    679
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by fretburner View Post
    Looks like the OP is using the Smarty template system.
    So those curly brackets in the IF Statement are proper syntax for Smarty? Never seen that before as well.

  11. #11
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,389
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by Drummin View Post
    So those curly brackets in the IF Statement are proper syntax for Smarty? Never seen that before as well.
    Yeah, I've never used it in any of my projects, but I've come across it while doing some PrestaShop work before. Here's a bit more info about Smarty's IF syntax: http://www.smarty.net/docsv2/en/lang...unction.if.tpl

  12. #12
    SitePoint Guru bronze trophy
    Join Date
    Feb 2013
    Posts
    679
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by fretburner View Post
    Yeah, I've never used it in any of my projects, but I've come across it while doing some PrestaShop work before. Here's a bit more info about Smarty's IF syntax: http://www.smarty.net/docsv2/en/lang...unction.if.tpl
    Oh, thanks fretburner. Then RayWilk, forget all my fumbling IF statements above. Looks like fretburners last example should do the job.
    If not, you might try an inline span style tag.
    PHP Code:
    {if $appearance.show_footer_categ}
    <
    div id="footer_categories">{$footer_links}</div>
    <
    span style="font-size:24px;">Text for the footer for my page</span>
    <!-- 
    end#footer_categories -->
    {/if} 

  13. #13
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Drummin and fretburner for your generous help, fantastic all working well

    Now I am trying to get the text to have the h2 tag,

    I added the bold below, yet not recognized as h2

    what have i done wrong ?

    {if $appearance.show_footer_categ}
    <span style="font-size:14px;"><h2>Text for the footer for my page</h2></span>
    <div id="footer_categories">{$footer_links}</div>
    <!-- end: #footer_categories -->
    {/if}

  14. #14
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I changed the code from:

    <span style="font-size:24px;">Text for the footer for my page</span>

    to:

    <h2 style="font-size:24px;">Text for the footer for my page</h2>

    yet not recognized as a h2 tag

  15. #15
    SitePoint Guru bronze trophy
    Join Date
    Feb 2013
    Posts
    679
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    My point about using span style was because <h2> might be getting striped out or overridden and maybe having an inline font-size of 24px might look like <h2>. Does it accept and adjusted font size?

  16. #16
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Drummin, yes the text size does adjust if I change the value, and color also changes, just no h2 recognized .... yet

  17. #17
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Drummin,

    Yes Yes all is well

    working perfectly, and recognized as a h2 tag, I did not make any code changes, just needed the right site to check my tags.

    Thank you again for all your generous clever help, best wishes


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
  •