Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2006-01-18 14:35:35

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

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
  1. Create the link using createElement
  2. Then you create and set the attributes the way you want them to be using setAttribute
  3. 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
  4. 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

#14 2006-03-19 11:20:08

The-Exit
Member
From: Berlin
Registered: 2005-07-16
Posts: 175
Website

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

#15 2006-03-19 19:35:54

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: upm_img_popper

Is this something that cannot be accomplished with the url attribute?


Shoving is the answer – pusher robot

Offline

#16 2006-03-19 19:44:31

The-Exit
Member
From: Berlin
Registered: 2005-07-16
Posts: 175
Website

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

#17 2006-03-19 23:56:48

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

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

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

Board footer

Powered by FluxBB