Judah Raine
Total posts: 332
28 Сен 2013 01:56

I am so very close to being done! I just entered my buy links, however and am getting display issues again. I did research the previous assistance you rendered here:

http://support.mintjoomla.com/en/cobalt-7/questions/Automatically +add+affiliate+code+to+link+from+form-2836.html

I have attached the url output template which contains the following:

value; $options = $this->params->get('params.open_url', 1) ? ' target="_blank"' : ''; echo JHtml:: link('http://' . $value[0]['url'].'?tag=romautjudrai-20', "

It is rendered in the default article template as:

fields_by_id[12]->result; ?>

The article displays this:

Is there perhaps some change with Cobalt 8 that I'm not aware of?

Many thanks,

Jude

Последние изменения: 02 Март 2014


Sergey
Total posts: 13,748
30 Сен 2013 02:21

Unfortunately I cannot understand what is wrong theer. because I do not know what you do expect.


Judah Raine
Total posts: 332
30 Сен 2013 05:23

They are essentially buy links. The user inputs the url to the book. The output template adds the affiliate code and displays it as an image link. I have checked that the image name and directory are correct. The code is the same that I used for the buy links when using Cobalt 7.

Thanks,


Sergey
Total posts: 13,748
01 Окт 2013 04:58

So you use Cobalt 7? Or Cobalt 8?


Judah Raine
Total posts: 332
01 Окт 2013 06:27

I'm now using Cobalt 8, but the last time I used the links I was using Cobalt 7. I thought they would work, but something is obviously different, I'm just not sure what.


Sergey
Total posts: 13,748
01 Окт 2013 06:58

I see.

But file you send looks ok to me. I am not sure but there is direct link through $this->value[0]['url'] and also cycle. May be you should use simple text field with URL validation. The it will be very easy to create template.


Judah Raine
Total posts: 332
01 Окт 2013 08:56

I am happy to try that. Would it display with the "button" (image) as well?


Judah Raine
Total posts: 332
01 Окт 2013 10:55

Ok, I confess you have me utterly confused :D I had a look at text feel and cannot find anything like "url validation" - the closest is regular expression or something to that effect. I have looked and found innumerable "explanations" of this in various php forums, but each one seems more confusing than the next. :O

Lordy. What now??


Sergey
Total posts: 13,748
02 Окт 2013 00:26

Yes, regex exactly what I meant. I think somethign like this wil work

(https?:\/\/)?([\da-z.-]+).([a-z.]{2,6})([\/\w .-])\/?

if it is not simplify it to

(https?:\/\/)?([\da-z.-]+).([a-z.]{2,6})(.*)


Judah Raine
Total posts: 332
02 Окт 2013 02:37

Just so I understand... I enter this in the field parameters, no problem there. Do I then have to make additional changes to the output template? I'm just not sure how the affiliate code is added in.

Many thanks


Judah Raine
Total posts: 332
03 Окт 2013 00:57

Hi there, I have tried both the above, and they both display as follows:

I would imagine that it has to do with the output template. I'm looking into that now, but if you have a quicker solution than hours on the internet, I'd greatly appreciate it, thank you.

Jude


Sergey
Total posts: 13,748
03 Окт 2013 03:53

What is PHP code that is displayed as Array?


Judah Raine
Total posts: 332
03 Окт 2013 06:43

Not at all sure how I would find that? If it's in the article template it's :

fields_by_id[12]->result; ?>
fields_by_id[10]->result; ?>

that's the two affiliate code fields I'm trying to display.


Sergey
Total posts: 13,748
03 Окт 2013 07:50

Try fields_by_id[12]->result[0]; ?> because it is an array.


Judah Raine
Total posts: 332
03 Окт 2013 08:52

I will try that, thank you


Judah Raine
Total posts: 332
03 Окт 2013 10:08

This is the result:

(the Array has become A)


Sergey
Total posts: 13,748
04 Окт 2013 03:54

What would

fields_by_id[12]->result) ?>

show?


Judah Raine
Total posts: 332
04 Окт 2013 05:47

string(5) "Array"

I assume that we're still using regex here? Perhaps I'm being really stupid, but I'm not sure why we're using text and not url? Not being difficult, just trying to understand so I can learn from this. My little pea brain would have thought that the url field would have been easier... though of course I have no idea why it worked so well on Cobalt 7 and not on Cobalt 8. thanks for all the effort.


Judah Raine
Total posts: 332
04 Окт 2013 09:15

Hmmm.... well, just for fun (seeing as I needed to try something :D) I went and set this back to url and it seems we have progress, though for the life of me I cannot think why. To the best of my knowledge I simply changed it from text to url. Anyway, the image is at least showing, though with other garbled stuff, and clicking on the link brings up server cannot be found at http. I'll re-enter the url just in case there's a problem there, but I do think the string 699 and " (image) " has something to do with it.


Judah Raine
Total posts: 332
04 Окт 2013 09:26

Just to save the bother of looking up the code:

value; $options = $this->params->get('params.open_url', 1) ? ' target="_blank"' : ''; echo JHtml:: link('http://' . $value[0]['url'].'?tag=romautjudrai-20', "", $options ) ; ?>

Sergey
Total posts: 13,748
07 Окт 2013 05:57

If you change one type to another you have to resave article as every type stores data differently.

Работает на Cobalt