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 :slight_smile:


<?php if ($appearance.show_footer_categ);	?>
<div id="footer_categories"><h2><?php echo $footer_links; ?></h2></div>
<!-- end: #footer_categories -->
<?php endif; ?>	  

OR


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

OR


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

OR


<?php
if ($appearance.show_footer_categ){	
echo '<div id="footer_categories"><h2>' . $footer_links . '</h2></div>';
}
?>

OR

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

OR

Hello Drummin, thank you for your fast and many optioned reply :slight_smile:

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 :slight_smile:

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
if ($appearance.show_footer_categ):
echo "<div id=\\"footer_categories\\"><h2>$footer_links</h2></div>\\r";
endif;
?> 

Hello Drummin, Thank you for your reply, and corection, but! still not working :frowning:

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 :slight_smile:

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}

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:


<div id="footer_categories"><h2>Footer title</h2>{$footer_links}</div>

Then style it as you wish in the CSS.

Well what is this?

$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


{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?

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/language.function.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.

{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}

Thank you Drummin and fretburner for your generous help, fantastic all working well :slight_smile:

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

I added the bold below, yet not recognized as h2 :frowning:

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}

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 :frowning:

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?

Hi Drummin, yes the text size does adjust if I change the value, and color also changes, just no h2 recognized … yet :slight_smile:

Hi Drummin,

Yes Yes all is well :slight_smile:

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 :slight_smile: