This topic is locked

Variable Hyperlink

5/1/2008 10:23:13 AM
PHPRunner General questions
P
privatelogic author

I have a field in my database that I would like to link to an image that is on another server and think this is possible. Here are the parameters:
The image (just an example url but everything after .com is correct) is located here: http://thewebsite.com/c-sc/sc?s=YUM&p=...6012&r=2109
The YUM is the same as the field that I want to link to so in my database it will be a variable but let's say it isn't YUM but rather AAPL in the database. If I use the same url for the image and substitute the APPL for YUM it will render the correct image.
The variable filed in my database is "symbol" and I saw how to set the "view as" setting, I'm just unclear how to code it correctly. Any help would be appreciated.

Admin 5/1/2008

You can use "View as" type "Custom" and the following code:

$value = "http://thewebsite.com/c-sc/sc?s="; . $value . "&p=D&b=5&g=0&i=t33998036012&r=2109";
P
privatelogic author 5/1/2008

You can use "View as" type "Custom" and the following code:


$value = "http://thewebsite.com/c-sc/sc?s="; . $value . "&p=D&b=5&g=0&i=t33998036012&r=2109";


Awesome! Thanks! This worked in that the variable appears in the link, but the whole code now shows up in that table rather than the variable. In addition, it isn't clickable so its just the code. I'd like it to open up in a new window, preferably 625x775 with no address bar, etc.

Admin 5/1/2008
$value = "<a target=_blank href='http://thewebsite.com/c-sc/sc?s="; . $value . "&p=D&b=5&g=0&i=t33998036012&r=2109'>Click here</a>";


If you need to control new window size, position etc you need to use Javascript.
Check this tutorial for more info:

http://www.htmlgoodies.com/beyond/javascri...cle.php/3471221

P
privatelogic author 5/14/2008

First off, thanks for your help thus far. I have made a valid attempt at this following your link but have been unsuccessful. I have spent three days trying different ways to accomplish what I want and haven't gotten anywhere. I'm the first to admit that my coding skills in php are weak at best (which is why I bought this software) but my javascript and html are even weaker! Anyone care to help me out with opening the link in a new window with the parameters I mentioned above?
Here is what I have and it works in opening the image, but I wanted it in a window with nothing but the image, like no scrollbar, etc.

$value = "<a target=_blank href=' http://ichart.finance.yahoo.com/z?s="; . $value . "&t=6m&l=on&z=l&q=c&p=e13,m200,m50&a=vm,r14&c='>Click Here</a>";


The $value is a stock ticker symbol and this is what the image looks like when it's called Link

J
Jane 5/15/2008

Hi,
here is just a sample:

$value = "<a target=_blank href=# onclick=\"java script: window.open('http://ichart.finance.yahoo.com/z?s="; . $value . "&t=6m&l=on&z=l&q=c&p=e13,m200,m50&a=vm,r14&c=','','height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');\">Click Here</a>";

P
privatelogic author 5/15/2008

Thanks Jane, I tried this and it opens a new window, but not of the chart, it is of the exact same page. I believe that is what the # sign does and I also believe that I should be adding an "on load" event somewhere, but don't know where.

J
Jane 5/16/2008

Hi,
you don't need to add another events.

URL of opened page is the first parameter of window.open() function.

Try to use this code:

$value = "<a href=# onclick=\"window.open('http://ichart.finance.yahoo.com/z?s="; . $value . "&t=6m&l=on&z=l&q=c&p=e13,m200,m50&a=vm,r14&c=','','height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');\">Click Here</a>";

P
privatelogic author 5/16/2008

Bingo! Thanks a ton!