Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Make PHP image a link

Posted on 2011-02-14
6
Medium Priority
?
462 Views
Last Modified: 2012-05-11
Hi.  I have a Joomla site and have added the following code to the main index.php file to add the social networking buttons to it, however not being familiar with PHP, I don't know how to make those images clickable and add the URLs.  Also need to make sure the URL target is blank so that people don't leave the website and a new web page is opened.  Any help would be great.
Thanks!
<div class="social"><p>Follow Us</p><img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/images/twitter.png" border="0" alt="<?php echo JText::_('Twitter'); ?>" width="15" height="19" /><img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/images/facebook.png" border="0" alt="<?php echo JText::_('Facebook'); ?>" width="22" height="22" /></div>

Open in new window

0
Comment
Question by:kmurphychi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 8

Accepted Solution

by:
PranjalShah earned 1000 total points
ID: 34891018
Here is an example for twitter..you can do the same for facebook...Surround your <img> tag with the <a href> tag...


<a href="http://www.twitter.com" target="_blank">
<img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/images/twitter.png" border="0" alt="<?php echo JText::_('Twitter'); ?>" width="15" height="19" />
</a>
0
 

Assisted Solution

by:jayadevneduvachalil
jayadevneduvachalil earned 1000 total points
ID: 34891067

Please try this
<div class="social"><p>Follow Us</p><a href="http://www.twitter.com" target="_blank"><img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/images/twitter.png" border="0" alt="<?php echo JText::_('Twitter'); ?>" width="15" height="19" /></a><a href="http://www.facebook.com" target="_blank"><img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/images/facebook.png" border="0" alt="<?php echo JText::_('Facebook'); ?>" width="22" height="22" /><a/></div>

Open in new window

0
 

Author Closing Comment

by:kmurphychi
ID: 34891145
Thank you!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Expert Comment

by:lazysheepmedia
ID: 34891154
why dont you use one of the many social plugins - All the hard ork is done for you
0
 
LVL 4

Expert Comment

by:Cristi_E
ID: 34891158
Hi,
Just try to put it in a link like this:

 
<div class="social">
	<p>Follow Us</p>
	<a href="http://twitter.com/"><img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/images/twitter.png" border="0" alt="<?php echo JText::_('Twitter'); ?>" width="15" height="19" /></a> 
	<a href="http://www.facebook.com/"><img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/images/facebook.png" border="0" alt="<?php echo JText::_('Facebook'); ?>" width="22" height="22" /></a>
</div>

Open in new window


Just follow the tutorial on how to create a link:
See: HTML Hyperlinks (Links)

Cristi
0
 
LVL 5

Expert Comment

by:lazysheepmedia
ID: 34891161
sorry submitted after you accepted the above - ah well :)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question