Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [plugin] [ORPHAN] glx_if: some conditional tags
hi johan,
i apologize for my tardiness in reply… things got a bit busy lately.
i installed that new vesion, thank you, but i still could not get glx_if_not_section_frontpage to work right. i have since persued another route and surrendered the idea of tidy sectioning…for now. thanks for your help. this plugin makes the other things i’ve done so much easier.
———
just as a side note, i added this to the function list for your plugin to account for certain things i was trying to do on my search page in the event of a search NOT having been attempted:function *glx_if_not_search*($atts, $thing)
{
global $pretext;
return (empty($pretext[“q”])) ? parse($thing) : “”;
}
Offline
Re: [plugin] [ORPHAN] glx_if: some conditional tags
thank you jase! i was just about to ask for this feature!
and thanks osei, for this indispensible plugin in the first place.
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
Re: [plugin] [ORPHAN] glx_if: some conditional tags
I’m confused: Let’s say you have a section page with lots of articles, some with comments closed and some with comments that are disabled because time has elapsed according to site preferences. Is there a way to treat these differently? Is there a way to deal with disabled comments instead of just with closed comments?
Offline
#28 2004-11-21 07:29:17
- sivni
- Gone, but not forgotten
- From: Norway, Hamar
- Registered: 2004-10-27
- Posts: 39
Re: [plugin] [ORPHAN] glx_if: some conditional tags
osei, your current 0.6.3 version made the glx_if_not_section_frontpage work. Awsome!
he he. I guessed the url for it. Sorry if that was a bit rude.
Offline
Re: [plugin] [ORPHAN] glx_if: some conditional tags
Just a note—this plugin does not handle DB name prefixes. I had problems until I dug through it and realized you specify table names without adding the PFX definition before them.
Example:
<code>
$rs = getRow(“SELECT COUNT AS num_of_comments
FROM txp_discuss
LEFT JOIN textpattern ON txp_discuss.parentid = textpattern.ID
WHERE textpattern.ID = $id AND textpattern.Annotate = 0”);
</code>
Should be:
<code>
$rs = getRow(“SELECT COUNT AS num_of_comments
FROM “.PFX.“txp_discuss
LEFT JOIN “.PFX.“textpattern ON “.PFX.“txp_discuss.parentid = “.PFX.“textpattern.ID
WHERE “.PFX.“textpattern.ID = $id AND “.PFX.“textpattern.Annotate = 0”);
</code>
This needs to be done in each of your SQL queries otherwise anyone who specifies db prefixes won’t be able to use your stuff accurately.
Edit: You actually only need to do it in that one case because you use safe_row() and such for the other queries which adds the prefix properly.
Hope this helps, great plugin.
Last edited by garrett (2004-12-20 23:37:01)
Offline
Re: [plugin] [ORPHAN] glx_if: some conditional tags
garrett, thanks for pointing that out, i update the plugin later and will then add jases new function to it aswell.
Johan Nilsson
Offline
Re: [plugin] [ORPHAN] glx_if: some conditional tags
New version 0.6.4
now includes
- glx_if_not_search
- glx_if_not_section_frontpage
Added support for DB prefixes, thanks garrett i totaly missed that.
Johan Nilsson
Offline
#32 2004-12-21 11:23:04
- Chris
- Member
- Registered: 2004-02-26
- Posts: 22
Re: [plugin] [ORPHAN] glx_if: some conditional tags
This is a great plugin! Must play with it some more.
Do you do requests? I’m looking for something along the lines of if_logged_in that would check for a TXP cookie and show content if it exists. If it could be restricted based on a users permissions (publisher, editor, freelancer, designer etc.) that would be even better but I don’t know if the cookie contains that info.
Offline
Re: [plugin] [ORPHAN] glx_if: some conditional tags
Chris, ramanam did something like that a while ago, maybe that is what you are looking for.
No i dont think the cookie contains that info, but we could get that info with a DB query.
Johan Nilsson
Offline
#34 2004-12-21 12:36:00
- Chris
- Member
- Registered: 2004-02-26
- Posts: 22
Re: [plugin] [ORPHAN] glx_if: some conditional tags
Ramanan’s plugin is cool. Have been trying to get it to detect the txp cookie but changing the script to look for txp_login doesn’t work.
Do you know how I might modify Ramanan’s plugin to check for a txp login cookie?
Thanks for your help Johan.
Offline
Re: [plugin] [ORPHAN] glx_if: some conditional tags
> osei wrote:
> Added support for DB prefixes, thanks garrett i totaly missed that.
No problem, nice work!
Offline
Re: [plugin] [ORPHAN] glx_if: some conditional tags
Just another note—in the new version, the comment above glx_if_not_section_frontpage() includes some non-utf characters which cause encoding problems in some browsers. It doesn’t stop the plugin from working, but you do see some unknown-character marks in the source of it.
Offline