Jump to content

Problem with <a href> and variable


dmendez12

Recommended Posts

Hi,

 

I have this piece of code that I can´t make it work. To give you a little background, this is not in a php file itself, it is part of a component in Joomla, which is based in php, and there is a section where I can input PHP code to modify some output.

 

The only thing I am pending is to add target="_blank" so it can open in New Window. I have tried all sort of things and nothing is working.

 

Here is the line that it WORKS but I need to add the target.

 

$items["title"]["value"] = "<a href=".$items['title']['value'].">Download Document</a>";

 

Please help me!

Link to comment
Share on other sites

have a look at the following, note though i added a line break on purpose so you can see what parts this link consists of.

 

<?php

$items['title']['value']= 3;  // just some value because i have no idea what is in there.

$items['title']['value'] =  //note the single quotes!!

'<a href="'                                 //note the single quotes around the first part and the double quotes to surround the attribute property 
.$items['title']['value'].               //note the appending dots
'" target="blank">Download Document</a>';   //note the single quotes around the last part and the double quotes for the attribute property

echo $items['title']['value'];



?>


Link to comment
Share on other sites

Thanks but that didn´t work.

 

I have tried that.

 

Just to make it clear, the echo of that is a filename.

 

echo $items['title']['value']; // the result of that is FILENAME.pdf

 

Any other idea? Or is there a way to declare the target attribute of <a> somewhere else?

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.