Mr.Canuck Posted July 21, 2013 Share Posted July 21, 2013 Good day. I am trying to add alt tags and title tags to these navigation images. For example, the "about us" navigation link is an image (aboutus.png). I want to be able to assign this navigation image alt and title attributes (aboutus.png alt="about us" title="about us"). As you can see, this menu is using an array. How could I add an alt and title to each navigation image? Thanks. <? $sitemap = array( "Our Company" => array( "About Us", "Our Team", "Our Customers", "Associations", "Community", "Health and Safety", "Request a Consultation", ), "Our Services" => array( "Our Process", "Landscape Consultation", "Landscape Design", "Landscape Construction", "Landscape Lighting", "Property Maintenance", "Snow and Ice Maintenance", "Frequently Asked Questions", "Request a Consultation", ), "Our Portfolio" => array( "Stonework", "Gardens", "Structures", "Water Features", "Property Maintenance", "Request a Consultation", ), "Contact Us" => array( "Details", "Request a Consultation", "Employment Opportunities", ), ); <div class="navigation-item"> <a href="<? print(strtolower(str_replace(" ", "", $categories . "-" . $pagename))); ?>.php"<? if ($section != strtolower(str_replace(" ", "", $categories))) { ?> onMouseOver="swap('navigation-item-<? print(strtolower(str_replace(" ", "", $categories))); ?>','images/<? print(strtolower(str_replace(" ", "", $categories))); ?>-over.png');" onMouseOut="swap('navigation-item-<? print(strtolower(str_replace(" ", "", $categories))); ?>','images/<? print(strtolower(str_replace(" ", "", $categories))); ?>.png');"<? } ?>><img id="navigation-item-<? print(strtolower(str_replace(" ", "", $categories))); ?>" src="images/<? print(strtolower(str_replace(" ", "", $categories))); ?><? if ($section == strtolower(str_replace(" ", "", $categories))) { ?>-over<? } ?>.png" border="0" alt="<? print($categories); ?>"></a> </div><? $printed = 1; } } if ($i + 1 < count($sitemap)) { ?><div class="navigation-divider"><img src="images/divider.png" width="2" height="23" border="0" alt="image divider" title="divider"></div><? } $i++; } ?></div> Link to comment https://forums.phpfreaks.com/topic/280375-add-alt-and-title-tags-to-php-array/ Share on other sites More sharing options...
Mr.Canuck Posted July 22, 2013 Author Share Posted July 22, 2013 No worries, I figured it out. Just had to add alt="<? print($categories); ?>" and title="<? print($categories); ?>" Simple oversight on my part. Link to comment https://forums.phpfreaks.com/topic/280375-add-alt-and-title-tags-to-php-array/#findComment-1441618 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.