?
Solved

Adding Link to Php code.

Posted on 2007-04-08
12
Medium Priority
?
205 Views
Last Modified: 2010-04-21
Hi Experts,

I need to include a link to another url to this bit of php code:

<div id="ja-sh" class="clearfix" style="background:url(<?php echo "$ja_template_path/images/$ja_color/$ja_headerimg"; ?>) no-repeat top right; ">

How would I do it.  Assume the link is to "http://www.foobar.com" and it would be in a new window.

Thanks!
0
Comment
Question by:Rowby Goren
[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
  • 5
12 Comments
 
LVL 20

Expert Comment

by:steelseth12
ID: 18873382
<a href="http://www.foobar.com" target="_blank">http://www.foobar.com</a> is this what you want ???

Im not sure i understood the question .
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18873669
For a division, you will need to add the onclick event handler.

<div id="ja-sh" class="clearfix" style="background:url(<?php echo "$ja_template_path/images/$ja_color/$ja_headerimg"; ?>) no-repeat top right; " onclick="openPopup('http://www.foobar.com')">

And you will need an event handler in JavaScript which you place within the HEAD tags of your page.

<script language="javascript" type="text/javascript">
<!--
var childPopup = null;

function openPopup(pURL) {
  // If the child popup is open, close it.
  if (childPopup != null) {
    if (childPopup.closed == false)
      childPopup.close()
  }
  // open the child popup.
  childPopup = window.open(pURL,'child');
  // return the window handle.
  return childPopup;
}
</script>

Regards,
Rod
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 18873723
Hi Rod,

After speaking with my client, he says he does not want it to be a popup.  SO can you revise your script so it opens in the same window.

Thanks

Rowby
0
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18873761
<script language="javascript" type="text/javascript">
function openPopup(pURL) {  // is now a stupid name for this function
     document.location = pURL;
}
</script>



0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18873800
Of course, if you are going to open it in the same window, you probably can simply do this....


<a href="http://www.foobar.com"><div id="ja-sh" class="clearfix" style="background:url(<?php echo "$ja_template_path/images/$ja_color/$ja_headerimg"; ?>) no-repeat top right; "></a>

Rod
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 18873803
Works perfectly Sage.

Is there any way to force the arrow to be a hand when it hovers over the link.  Or is this something I need to ask in Experts Exchane CSS section.

Rowby
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 18873807
Hold on --- I'll try your second solution now to see if it keeps the hand instead of the arrow.

Stay tuned...

0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18873811
#ja-sh {
    cursor:hand;
}
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 18873938
Hmmm Sage,
For some reason your solution has "stopped working".  The hand is fine.  But in both IE and Firefox the link does't work.

I think it could have to do with the page failing validation.  If you can go to this link and then to the bottom of the page you will see a W3C link where you can check the 2 valdation problems.  If this is beyond the scope of this question/ EE Forum, then let me know and I will take a short visit to the IE Css section.

http://www.coveryourcar.com/new/

THe link that we have been working on is the Start Here button.
No hurry.  This page is not live.

Rowby
0
 
LVL 29

Accepted Solution

by:
rdivilbiss earned 2000 total points
ID: 18874024
Oh looks like you're missing a ending <.DIV> tag someplace.

I like the onclick with CSS the best.  Wrapping a DIV with an anchor could have some issues.
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 18874218
I'll find that DIV.     May not get back to it until Tues...

Stay tuned!
0
 
LVL 9

Author Closing Comment

by:Rowby Goren
ID: 31407192
THanks for your help and sorry for the delay in awarding the points!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

800 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