Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-05-15 21:13:06

maartenD
Member
From: Warnsveld, The Netherlands
Registered: 2007-12-08
Posts: 47
Website

plugin not always working

Hi all,

I am trying to create my first plugin.

The plugin gets images from the db from a specific category. Then i show them on the page.

when i enter the url http://www.example.com/category1 the plugin works great, but when i enter http://www.example.com/category1/ it goes wrong. The images aren’‘t shown. When i put the mouse on the thumbnail i see read this: http://www.example.com/category1/images/18.jpg. When the last ‘/’ isn’t in the URL everything works fine.

Is there anyone how can tell me how to solve this problem?

Thanks in advance.

Kind regards,

Maarten.


Kind regards,

Maarten

Offline

#2 2008-05-15 21:16:38

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: plugin not always working

it goes wrong = the plugin generates an incorrect URL for the image or it doesn’t generate an URL at all.

Please provide more details.

Offline

#3 2008-05-16 04:38:02

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: plugin not always working

You need to be using an absolute URL. The PHP constant hu contains the full url to the site with an ending slash.

Offline

#4 2008-05-16 08:49:53

maartenD
Member
From: Warnsveld, The Netherlands
Registered: 2007-12-08
Posts: 47
Website

Re: plugin not always working

Hello guys,

thx for the replies.

What i do to create the url is this:

$thumb = $img_dir.'/' . $id . 't' . $ext;

the variable $thumb is placed in the href tag.

I do the same for the full image.

Hope anybody can help.

Kind regards,

Maarten.


Kind regards,

Maarten

Offline

#5 2008-05-16 09:21:33

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: plugin not always working

$thumb = hu. $img_dir.'/' . $id . 't' . $ext;

Offline

#6 2008-05-16 20:09:29

maartenD
Member
From: Warnsveld, The Netherlands
Registered: 2007-12-08
Posts: 47
Website

Re: plugin not always working

Hello all,

thanks for the answers. Now it works.
What i would like to know is, is hu a constant variable of textpattern or PHP. If it’s PHP can you tell me were i can find some documentation about constants in PHP?

Thx in advance.

Maarten.


Kind regards,

Maarten

Offline

#7 2008-05-16 21:21:55

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: plugin not always working

It’s a TXP-defined constant (see L85 of textpattern/publish.php).

Constants and how to define them.

Last edited by jm (2008-05-16 21:22:45)

Offline

Board footer

Powered by FluxBB