Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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: 12,476
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.

Hire 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: 12,476
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.

Hire 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

#25 2007-12-19 00:17:13

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

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

v0.5 now saves a good chunk of queries (still not fully optimized but getting there)

the_ghost: hmm i’ll see what i can do.

Last edited by iblastoff (2007-12-19 00:19:43)

Offline

#26 2007-12-19 03:31:52

masa
Member
From: North Wales, UK
Registered: 2005-11-25
Posts: 1,095

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

Wow, this morning there was version 0.1 and now we’re up to 0.5 already!

Anyway, 0.5 does work here even on 4.0.4 – excellent.

Thanks!

Offline

#27 2007-12-19 04:09:10

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

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

Make sure you change the version number in the documentation and so it reflects upon install. Right now it says v.0.3.


Art Rogue – Fine Art Photography

Offline

#28 2007-12-19 06:31:40

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

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

I have an idea. How about having a selected=“whatever-category”, whether that’s an option or optgroup so something shows in the select field.


Art Rogue – Fine Art Photography

Offline

#29 2007-12-19 06:56:41

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

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

you can’t have an optgroup as something selected since they’re not selectable. you could have something like <txp:lam_category_popup selected=“shop here!” /> or something and instead of the currently black initial field it would obviously say “shop here!”. if thats ok that can definitely be added.

Last edited by iblastoff (2007-12-19 06:57:03)

Offline

#30 2008-01-25 06:58:52

SebastianS
Member
From: Australia
Registered: 2007-10-05
Posts: 46

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

Is it possible to, or how does one style the “lam_category_popup”.
I am using Textpattern 4.05 on xampp.
Tag I have tried is <txp:lam_category_popup wraptag=“ul” break=“li” />, I don’t think pop ups have “style” attributes.
I want to be able to change the dimensions
or at least the width of the pop up window,
and more importantly choose colour of text and background in popup window,
or at least have black text on white background throughout.

Currently the text is black on white, white on black and no text background blue.

Any suggestions would be appreciated.

Offline

Board footer

Powered by FluxBB