Jump to content

add alt and title tags to php array


Mr.Canuck
Go to solution Solved by 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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.