Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2006-09-26 23:35:48

cbeyls
Archived Plugin Author
From: Brussels, Belgium
Registered: 2005-09-12
Posts: 136
Website

Re: cbs_navigation_menu

So, you removed this:
pagelinkurl(array('c'=>$name, 's'=>$section))

“pagelinkurl” is a Textpattern built-in function to create URL’s. Normally it works fine, so I’m curious to know why it doesn’t work on your website.

Also, why have you used the $s variable? In the original code above, it’s $section. By default it’s the same as $s, but it can change if you specify another section as parameter.


My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)

Offline

#14 2006-09-27 11:16:06

rossharvey
Member
From: Earth. Sometimes.
Registered: 2005-03-16
Posts: 233
Website

Re: cbs_navigation_menu

I have no idea either, I looked at the pagelinkurl source code and couldn’t see why. I use 4.0.3 standard.

In the pagelink code above, you’re instantiating <code>$section</code> dynamically (and hence locally) using the <code>$s</code> variable within the array. Without that code, <code>$section</code> doesn’t exist. You instantiate <code>$s</code> in the intital attribute extraction, which is why it has to be used.

Offline

#15 2006-09-27 15:04:08

cbeyls
Archived Plugin Author
From: Brussels, Belgium
Registered: 2005-09-12
Posts: 136
Website

Re: cbs_navigation_menu

rossharvey wrote:

In the pagelink code above, you’re instantiating <code>$section</code> dynamically (and hence locally) using the <code>$s</code> variable within the array. Without that code, <code>$section</code> doesn’t exist. You instantiate <code>$s</code> in the intital attribute extraction, which is why it has to be used.

Let me explain it more clearly. $s is a global variable instantiated by Textpattern, which contains the current section name. At the beginning of the plugin function I declare I want to use it. Then, I extract the plugin attributes to instantiate them as variables using the extract() call. One of these attributes, ‘section’, becomes the $section variable. If the ‘section’ attribute is not specified, the default value of the $section variable will be the current section, which is stored in the global $s variable. So, if in your code change you use the $s variable instead of $section, it will work as long as you don’t specify the ‘section’ attribute with a section which is different from the current section. If you do, the links will point the the right categories but in the wrong section (the current one instead of the specified one).


My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)

Offline

#16 2006-09-27 15:24:28

rossharvey
Member
From: Earth. Sometimes.
Registered: 2005-03-16
Posts: 233
Website

Re: cbs_navigation_menu

I did initially try and use <code>$section</code> instead of <code>$s</code>, but it failed.

However, I just edited it back to <code>$section</code> and it works. Must have had a typo in it the first time :¬)

Offline

#17 2006-09-27 16:40:11

akokskis
Plugin Author
From: Baltimore-ish, USofA
Registered: 2004-11-28
Posts: 230
Website

Re: cbs_navigation_menu

On a semi side note, cbeyls, I see talk of the global <code>$s</code>. Are you aware that this has been deprecated ? Use <code>$pretext[‘s’]</code> instead (of course, you’d have to declare <code>$pretext</code> as a global obviously to get this to work).

Just thought you should know, in terms of future compatibility.


My Photoblog, and my personal site. Got nav? ako_nav.
Thanks for taking the time to look…

— vc3 —

Offline

#18 2006-09-28 01:30:33

cbeyls
Archived Plugin Author
From: Brussels, Belgium
Registered: 2005-09-12
Posts: 136
Website

Re: cbs_navigation_menu

Thank you, actually I didn’t know if it was best to use $s or this strange $pretext variable. I’ll update the code of my plugins.


My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)

Offline

#19 2006-10-13 23:14:22

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: cbs_navigation_menu

Hey Christophe, any way to drop the trailing / from the url output from you lovely plugin?

Like: features and not features/

Thanks, Lee

Offline

#20 2006-10-14 08:56:51

cbeyls
Archived Plugin Author
From: Brussels, Belgium
Registered: 2005-09-12
Posts: 136
Website

Re: cbs_navigation_menu

I’m relying on a Textpattern function to generate URL’s, so no, it’s not possible unless you change that function in the Textpattern code. I rely on that function because it generates clean or messy URL’s depending on the current configuration.

But I’m wondering why you need this since sections are made to appear like subfolders in clean URL mode and you should add a trailing slash when you’re linking to a subfolder even if it works without it.


My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)

Offline

#21 2006-10-14 09:10:24

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: cbs_navigation_menu

cbeyls wrote:

But I’m wondering why you need this since sections are made to appear like subfolders in clean URL mode and you should add a trailing slash when you’re linking to a subfolder even if it works without it.

Thanks for getting back to me. I’m trying to use http://textpattern.org/plugins/654/directory-gallery which pulls images direct from a real directory. Let’s say there are some images in the photos directory in the root of the server: If I’m in www.myworld.com/features/ (notice the trailing /) the the directoy-gallery plugin tries to fetch the images from www.myworld.com/features/photos/ – and fails. But if the url is www.myworld.com/features the directory-gallery finds the images in www.myworld.com/photos no problem. Do you have any suggestions?

Many thanks, Lee

Offline

#22 2006-10-14 20:15:22

cbeyls
Archived Plugin Author
From: Brussels, Belgium
Registered: 2005-09-12
Posts: 136
Website

Re: cbs_navigation_menu

So, it’s a known bug in your gallery plugin. That’s because the author passes a relative path to the opendir() php function, instead of an absolute one. I will look at the code of this plugin and post a fix.

Edit: seems harder than I thunk, the plugin does not work at all on my test server. I’ll look at the code to see how I could fix it. Furthermore, this plugin only works with PHP5 because it uses PHP5-specific functions, even if the homepage mentions that it has been tested with PHP 4.0.4.

Last edited by cbeyls (2006-10-14 20:48:21)


My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)

Offline

#23 2006-10-14 20:18:51

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: cbs_navigation_menu

That would be brilliant, many thanks for taking the time to look in to it.

Offline

#24 2006-10-15 16:07:35

cbeyls
Archived Plugin Author
From: Brussels, Belgium
Registered: 2005-09-12
Posts: 136
Website

Re: cbs_navigation_menu

So… I looked at the code of directory-gallery. Not the best I’ve ever seen. Well okay, the author says he’s not a web developer but a C and assembler guy. Maybe he hasn’t noticed that PHP is very similar to C, with a more flexible type system and more available functions.

Well, I don’t want to rewrite this plugin, I just want to make it work as it should so lee can use it on his site along with cbs_navigation_menu.

So, Lee, find this block in the code of directory-gallery and replace it with this block.

You still need to prefix the images with 2 digits or they will not be listed, but this time you can use any 2-digit number (previously you could not use “0” as second digit!) and even twice the same number, images will then be sorted alphabetically.

You must place the images folder in the root folder of your website, at the same level as the textpattern folder and just reference it like this for example: ‘folder’. Or you can use a subfolder and reference it like this: ‘folder/subfolder’. You get the idea. And now the gallery will work with any URL, including the ones with a trailing slash, because the paths are now absolute instead of relative.

Note: Please be patient with the pastebin website, it may take 2 or 3 minutes to display the page, I hope they will fix that soon.

Last edited by cbeyls (2006-10-15 16:10:28)


My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)

Offline

Board footer

Powered by FluxBB