judah Posted October 2, 2013 Share Posted October 2, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/282624-url-field-output-to-display-as-image-with-affiliate-link/ Share on other sites More sharing options...
Ch0cu3r Posted October 2, 2013 Share Posted October 2, 2013 (edited) 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 October 2, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/282624-url-field-output-to-display-as-image-with-affiliate-link/#findComment-1452164 Share on other sites More sharing options...
judah Posted October 2, 2013 Author Share Posted October 2, 2013 Oh, won't I just be so irritated if this was the problem and I missed it all the while... thanks, I'll have a look. Quote Link to comment https://forums.phpfreaks.com/topic/282624-url-field-output-to-display-as-image-with-affiliate-link/#findComment-1452224 Share on other sites More sharing options...
judah Posted October 2, 2013 Author Share Posted October 2, 2013 Nope, that didn't fix it, but thanks so much anyway Quote Link to comment https://forums.phpfreaks.com/topic/282624-url-field-output-to-display-as-image-with-affiliate-link/#findComment-1452261 Share on other sites More sharing options...
judah Posted October 3, 2013 Author Share Posted October 3, 2013 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 427Notice: Trying to get property of non-object in /home/classicr/public_html/components/com_cobalt/views/record/tmpl/default_record_library.php on line 427Notice: Undefined offset: 5 in /home/classicr/public_html/components/com_cobalt/views/record/tmpl/default_record_library.php on line 428Notice: 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 Quote Link to comment https://forums.phpfreaks.com/topic/282624-url-field-output-to-display-as-image-with-affiliate-link/#findComment-1452377 Share on other sites More sharing options...
judah Posted October 9, 2013 Author Share Posted October 9, 2013 So I'm nothing if not persistent (and utterly desperate) 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 Quote Link to comment https://forums.phpfreaks.com/topic/282624-url-field-output-to-display-as-image-with-affiliate-link/#findComment-1453299 Share on other sites More sharing options...
boompa Posted October 9, 2013 Share Posted October 9, 2013 The first thing to do here is to view the source being generated by your PHP. What does the HTML for that link look like? Quote Link to comment https://forums.phpfreaks.com/topic/282624-url-field-output-to-display-as-image-with-affiliate-link/#findComment-1453325 Share on other sites More sharing options...
judah Posted October 10, 2013 Author Share Posted October 10, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/282624-url-field-output-to-display-as-image-with-affiliate-link/#findComment-1453368 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.