Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: upm_img_popper
It’s basically just done by traversing the DOM and creating a link element where you want it to be. The admin interface doesn’t have a lot of DOM of elements with IDs so it makes it a little harder then it needs to be. Currently img_popper uses a fairly frail system to place the link that will break if the admin interface changes. I’m working on an update that is a little more foolproof, but it’s still not as easy as it could be.
So basically you- Create the link using createElement
- Then you create and set the attributes the way you want them to be using setAttribute
- Basically then you need to insert it somwhere. For img_popper I find the ID for “Advanced Options” using getElementByID and then get the parent using parentNode. Since the Advanced DIV has a Paragraph before it with the link that activates you get that using previousSibling
- You can then insert the link in using insertBefore
The basic code looks like
<pre>
<code>
//create the link
var link = document.createElement(‘a’);
link.setAttribute(‘href’, ‘/where/to/link/to/’);
//place it
var node = document.getElementById(‘advanced’);
node.parentNode.insertBefore(link, node.previousSibling);
</code>
</pre>
And that should do it. DOM inspector is your friend for this sort of stuff. “Advanced options” is good because I think it’s always there no matter what preferences you have set (actually I should double check that).
Let me know if that makes sense otherwise I can write a more detailed example. I might move this into textbook if it makes sense.
Shoving is the answer – pusher robot
Offline
Re: upm_img_popper
Hi
I’m just thinking of a new feature for this lovely plugin. Sometimes, I’d like to use an image as link. So, it would be great to use links in the customized templates.
I’m thinking of an optional tag, e.g.
<code><txp:upm_image image_id=“1062” form=“cartoon” link=“http://www.textpattern.org”/></code>
In the template, you can put the link whereever you want, unless you specify this option. If the link is not given, no a-tag will be produced.
What do you think?
Cheers, Matthias
Offline
Re: upm_img_popper
Is this something that cannot be accomplished with the url attribute?
Shoving is the answer – pusher robot
Offline
Re: upm_img_popper
Thank you for your answer.
This is exactly what I was looking for. I just haven’t see this attribute in the help. Sorry.
Offline
Re: upm_img_popper
It’s always nice when something you wnat is already there :)
Shoving is the answer – pusher robot
Offline
#18 2006-06-03 22:22:46
- Brutal
- Member
- Registered: 2005-01-28
- Posts: 14
Re: upm_img_popper
Hi.
I’m trying to use the upm_img_popper custom form, but the documentation for this function seems to have been deleted from the help-file, and I have no idea how the form should look. Can someone give me a quick run-through on how to use it?
Offline
#19 2006-06-03 23:35:53
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: upm_img_popper
Offline
#20 2006-06-04 00:38:41
- Brutal
- Member
- Registered: 2005-01-28
- Posts: 14
Re: upm_img_popper
That was EXACTLY what I was looking for. Thanks!
Offline