Jump to content

add alt and title tags to php array


Mr.Canuck

Recommended Posts

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.