Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2007-12-18 20:33:29

mattmikulla
Member
From: Nashville Tennessee
Registered: 2004-08-25
Posts: 281
Website

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

My local server is MAMP. My remote server is Media Temple. I am running 4.0.4 as well on both.


Art Rogue – Fine Art Photography

Offline

#14 2007-12-18 20:35:35

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

i’m exclusively running 4.0.5. i have no idea if that would be the issue though. any reason why both of you havent updated? i’m gonna take a look at the tag handlers for 4.0.4 if i can find them and see if popup is set up any differently. i’ll be back shortly.

in the meantime, anyone here running 4.0.5 can confirm if the plugin works for you or not? also, both of you are welcome to guest accounts at the demo site so you can peak at the backend and see that i’m not just pulling your leg about the plugin working.

also does anyone know where i can get txp 4.0.4 still? i can see it on dev.textpattern.com but i have no idea how to grab it without having to download each individual file manually.

Last edited by iblastoff (2007-12-18 20:57:03)

Offline

#15 2007-12-18 20:59:07

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,279
Website GitHub

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

I’m running 4.0.5: no dice :-(

It seems to be a case sensitivity issue. If your category title differs in case from the category name then it only shows the parent.

e.g. I have a category named ‘artwork’, but I’ve capitalised the name to ‘Artwork’ so it looks better on-screen. This category won’t show up in the list. If I rename both to ‘artwork’ it’s fine.

Incidentally, can you utilise the getTree() function in txplib_db.php instead of using your own lam_child_query?

Last edited by Bloke (2007-12-18 20:59:34)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#16 2007-12-18 21:04:42

mattmikulla
Member
From: Nashville Tennessee
Registered: 2004-08-25
Posts: 281
Website

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

Sorry. I’m running 4.0.5 as well.

That could be it. I have all of my category titles capitalized for display output and names lowercase.

Yep. I changed the category titles to lowercase and they showed up. Hopefully it won’t be a biggie to change that.

Last edited by mattmikulla (2007-12-18 21:10:29)


Art Rogue – Fine Art Photography

Offline

#17 2007-12-18 21:07:33

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

Bloke wrote:

I’m running 4.0.5: no dice :-(

It seems to be a case sensitivity issue. If your category title differs in case from the category name then it only shows the parent.

e.g. I have a category named ‘artwork’, but I’ve capitalised the name to ‘Artwork’ so it looks better on-screen. This category won’t show up in the list. If I rename both to ‘artwork’ it’s fine.

Incidentally, can you utilise the getTree() function in txplib_db.php instead of using your own lam_child_query?

thanks bloke! i had a feeling it was probably something to do with changing the category title and names from their generated defaults. also, you can see that i’m really not utilising much of the functions txp already provides (as i’m not familiar with all of them) but thanks for the heads up about getTree().

edit: after looking at getTree(), i don’t understand the ’1=1’ for $WHERE?

Last edited by iblastoff (2007-12-18 21:28:54)

Offline

#18 2007-12-18 21:26:43

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,279
Website GitHub

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

iblastoff wrote:

i’m really not utilising much of the functions txp already provides (as i’m not familiar with all of them)

Hehehe, same boat I was in a few months back (and still am in to a great extent – I keep finding things in the core and going “D’oh!, wish I’d looked for that earlier…”)

The only reason I know about getTree() is ‘cos I wrote a function to do it in smd_lib then found the one in the core much later, so I deprecated my version.

You might not be able to use it because of the sorting you’re doing in the query, but since getTree() (and getTreePath(), though I’m buggered if I can tell them apart functionally) returns an array of all the things under a given parent, you may be able to use PHP sorting on it. *shrug* no biggie if it’s not quite the right fit for your plugin; your solution works fine :-)

The “1=1” is just the default in case you don’t specify a where clause when calling the function. It’s a standard kludge. Without something in the where clause, SQL complains about an invalid query. And since 1=1 always evaluates to true, you get everything…

I think I remember a recent changeset by Mary highlighting something to do with removing the 1=1 dependence. Not sure if that was universal or just for certain parts of the core, I never delved into it.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#19 2007-12-18 21:33:49

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

ahhh i see! thanks for the clarifying. the plugin ORIGINALLY took all of the category names (ie. the category name that includes dashes for spaces. i always have to check which is which) and put them as optgroups, and then spit out each child underneath.

but i had to hack around and find a way for it to output the TITLE instead which i believe is resulting in people not seeing the children since the way i’m checking only seems to work if both title and name match up (ie the only changes would be the spaces/dashes). i think getTree() will solve this.

be back in a bit!

Offline

#20 2007-12-18 22:10:05

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

alright. round 3. let me know if this one finally takes the cake. (still needs some refactoring and i didn’t completely remove the $lam_child_query yet. i think i may need it in order to sort the children. either way just seeing if this makes a difference)

category names and titles shouldn’t have to exactly match up anymore nor should they be case sensitive now. let me know! once again this works fine on my own testing but of course that doesn’t mean anything for the rest of you :)

Last edited by iblastoff (2007-12-18 22:23:58)

Offline

#21 2007-12-18 22:27:48

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,279
Website GitHub

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

Sweet :-)

I wonder if judicial use of getTree() will allow you to move towards listing children from sub-sub-categories too… but maybe that’s getting silly in a dropdown.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#22 2007-12-18 23:01:45

mattmikulla
Member
From: Nashville Tennessee
Registered: 2004-08-25
Posts: 281
Website

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

Seems to be working now.

Here are the error codes, if they mean anything:

tag_error <txp:lam_category_popup categories="color" this_section="1" /> ->  Notice: Undefined variable:  lam_parent_title  on line 53
textpattern/lib/txplib_misc.php(534) : eval()'d code:53 lam_category_popup()
textpattern/publish.php:963 lam_category_popup()
textpattern/publish.php:922 processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/lib/txplib_misc.php:1383 parse()
textpattern/publish/taghandlers.php:243 parse_form()
textpattern/publish.php:963 output_form()
textpattern/publish.php:922 processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/publish/taghandlers.php:2709 parse()

Art Rogue – Fine Art Photography

Offline

#23 2007-12-18 23:08:21

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

whoops! lam_parent_title doesn’t exist anymore. forgot to remove it completely.

v0.4 should resolve it.

let me know if it does.

also: since bloke kindly mentioned the gettree() function, i can probably add the option of whether or not to show empty parent categories (empty as in it has no children) even if you don’t specify any categories to include at all.

so something like <txp:txp_category_popup showempty="0" /> would list all of your parent categories minus any empty ones. might add it if anyone needs that sort of thing.

ps. sorry for all of the back and forthness! still new to textpattern plugin development and php in general.

Last edited by iblastoff (2007-12-18 23:16:13)

Offline

#24 2007-12-19 00:15:31

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: lam_category_popup v0.5 (category popup selector using optiongroups)

What about adding amount of articles per sub category and sum of all subcategories’ articles for parent category? :)

Last edited by the_ghost (2007-12-19 06:52:13)


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

Board footer

Powered by FluxBB