Jump to content

Url field output to display as image with affiliate link


judah

Recommended Posts

Hi there, so sorry to bug you but I have run into an issue I cannot seem to solve.

 

I have a submission form into which my author's add their book buy links at Amazon, B and N (Linkshare) and Smashwords. This is a pre-defined form input, the field type in question set as "url".

The url then displays as an image (pre-defined in the output) link with my affiliate code automatically added via the output template.

 

I had saved this template previously but now, when I add it, the links display as never ending text (with link) not image, and the links include all the affiliate information.

 

The particular lines of code are:

<?php

$value = $this->value;

$options = $this->params->get('params.open_url', 1) ? ' target="_blank"' : '';

echo JHtml:: link('http://' . $value[0]['url'].'?tag=romautjudrai-20', "<img src='".JURI::root()."images/library/amazon.png'", $options ) ;

?>

I have poured over the this a gazillion times and for the life of me cannot find an error. I would greatly appreciate any and all assistance, thank you. File attached.

 

Jude

amazon.php

Link to comment
Share on other sites

Not sure, but you're not closing the <img> tag correctly

echo JHtml:: link('http://' . $value[0]['url'].'?tag=romautjudrai-20', "<img src='".JURI::root()."images/library/amazon.png'>", $options ) ;
                                                                                                                           
^ missing the > character

Edited by Ch0cu3r
Link to comment
Share on other sites

I set system error to developer, and found the following:

 

Notice: Undefined offset: 13 in /home/classicr/public_html/components/com_cobalt/views/record/tmpl/default_record_library.php on line 427

Notice: Trying to get property of non-object in /home/classicr/public_html/components/com_cobalt/views/record/tmpl/default_record_library.php on line 427

Notice: Undefined offset: 5 in /home/classicr/public_html/components/com_cobalt/views/record/tmpl/default_record_library.php on line 428

Notice: Trying to get property of non-object in /home/classicr/public_html/components/com_cobalt/views/record/tmpl/default_record_library.php on line 428

 

The row numbers correspond with the two links I'm trying to generate. I'd appreciate it if someone could point me in the right direction here. I have run the code through various php checkers and it came back with no errors.

 

Many thanks,

Jude

Link to comment
Share on other sites

So I'm nothing if not persistent (and utterly desperate) :confused:  I have really tried to resolve this myself, and thus far have managed to get rid of all the above errors, and I've got the image to display finally.  However, the image displays as a link (which goes to :  The requested URL /www.amazon.com/Still-Running-BookStrand-Publishing-Judah/dp/1606012134/ref=la_B0032ZVHUM_1_3 was not found on this server.

 

the actual link entered on the submission form displays next to the image. If I click on it, it goes to the correct page. The link, however, does not include the amazon associate tag when it displays. I'm utterly at my wits' end here, and cannot even begin to say how much I would appreciate some help to resolve this. I've been  at it for weeks, with no luck at all.  The code again is:

<?php
$value = $this->value;
$options = $this->params->get('params.open_url', 1) ? ' target="_blank"' : '';
echo JHtml::link('http://' .$value[0]['url'].'?tag=romautjudrai-20', "<img src='".JURI::root()."images/library/amazon.png'>", $options ) ;
?>

In summary, the url is added in a submission form. I need the link displayed as an image with the affiliate code automagically added. The code above is one I used before, but which now will not work, no matter what I do.

 

Thanks,

Jude

Link to comment
Share on other sites

Sorry, I'm in South Africa so time zones will be different.  I looked at page source and this is what I found:

<div><a href="http://http://www.amazon.com/Still-Running-BookStrand-Publishing-Judah/dp/1606012134/ref=la_B0032ZVHUM_1_3?s=books&ie=UTF8&qid=1380896274&sr=1-3?tag=romautjudrai-20" target="_blank"><img src='http://classicromancerevival.com/images/library/amazon.png'></a>

                    
        
        <a href="http://www.amazon.com/Still-Running-BookStrand-Publishing-Judah/dp/1606012134/ref=la_B0032ZVHUM_1_3?s=books&ie=UTF8&qid=1380896274&sr=1-3" target="_blank" rel="nofollow">
            http://www.amazon.com/Still-Running-BookStrand-Publishing-Judah/dp/1606012134/ref=la_B0032ZVHUM_1_3?s=books&ie=UTF8&qid=1380896274&sr=1-3        </a> </div>

To me it looks like it's putting the url in twice?

 

The url of the article output is :  http://classicromancerevival.com/library/user-item/506-judah-raine/1-still-running

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.