Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-10-01 20:46:22

Paqui
Member
Registered: 2005-08-16
Posts: 13

txp:popup type=

Hi,

My problem:
My front page should not show all articles which are published, some categories should not appear on the front page.
On the other hand, I would like to offer the possibility to select all articles of any of those categories by selecting its name in a popup menu.
But:
The tag txp:popup type=”c” seems to work only for articles appearing on the front page …
What can I do?
Thanks for any help.

Paqui

P.S. I hope I did not miss an obvious answer to my question …

Offline

#2 2005-10-01 22:18:56

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: txp:popup type=

By default TXP will use the default template or front-page to show a category listing. If articles have been assigned to a section that is not allowed to appear on the front-page (as per your settings in the “Section” tab) they will not appear in the category list.

On your front-page do you have just a single section that is allowed or is it a mixture?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2005-10-02 01:56:25

Paqui
Member
Registered: 2005-08-16
Posts: 13

Re: txp:popup type=

> thebombsite wrote:

> On your front-page do you have just a single section that is allowed or is it a mixture?

In order to give the most precise description, I describe the purpose of my web site.
The site is for my pupils belonging to different classes in a school.
The front page only shows the section “news”: this content concerns all pupils. But I do not want to put content for any determined class on the front page, since this would provide a lot of front-page information that is useful to a minority and useless for most of the pupils.
On the other hand, I have a lot of articles – section “article” and various categories (=the different classes). I would like that my visitors could pick the articles of category “class 8” for example using a popup menu on the front page.
And precisly, this seems not to work as long as I do not allow the section “article” to appear on the front page.

Thank you very much for helping to find a solution for my problem :-)

Paqui

Offline

#4 2005-10-02 02:44:27

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: txp:popup type=

Well just thinking out loud and remembering that it is 3:30am ish if you replaced the <code><txp:article /></code> tag on your front-page with the <code><txp:article_custom /></code> tag and specified the section=news attribute you could then allow your other sections to appear on the front-page. Then install the glx_if plug-in which has the <code><txp:glx_if_category_list></txp:glx_if_category_list></code> tags between which you could use the <code><txp:article limit=“5” /></code> tag and style your listing accordingly.

I’m now going to bed just in case….. ;)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2005-10-02 08:23:37

Paqui
Member
Registered: 2005-08-16
Posts: 13

Re: txp:popup type=

Hi Stuart,
Your help even at 3:30am is much appreciated :)
Your solution works fine in the sense that now, the list of articles in a specified category is given when selected with the popup menu :)
But this time I get more than I wanted: the news from the front page are listed as well …
How to get rid of them? Selecting “class 8” with the popup menu should list only the articles of the specified category.
Thanks again for your help :)
Paqui
P.S. Maybe the solution is obvious and maybe tomatoes or some other vegetables on my eyes prevent me from seeing it ;)
But I am still rather new to textpattern, and I have the impression that I still did not grasp some fundamental facts about the code. So I progress with the method of “trial and error”, and I hope that within a couple of weeks, I’ll have reached an acceptable state of knowledge.

Offline

#6 2005-10-02 13:39:18

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: txp:popup type=

Are your News items using the same categories?

Edit.

Wrong question. I’m now thinking that you get your category list which is then followed by the News section?

Last edited by thebombsite (2005-10-02 13:42:49)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#7 2005-10-02 13:53:20

Paqui
Member
Registered: 2005-08-16
Posts: 13

Re: txp:popup type=

> thebombsite wrote:

> I’m now thinking that you get your category list which is then followed by the News section?

No – I get first the News section and then the category items.

Paqui

Offline

#8 2005-10-02 14:15:50

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: txp:popup type=

OK. Same thing really you just have your code the other way round. :) We need to add a new function to the glx_if plug-in. It is a simple copy/paste. Are you OK to try that?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#9 2005-10-02 14:17:53

Paqui
Member
Registered: 2005-08-16
Posts: 13

Re: txp:popup type=

Sure I want to try it.
There is nothing to lose and a lot to win :)

Paqui

Offline

#10 2005-10-02 14:33:00

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: txp:popup type=

Well if you have a problem you could always create a login for me and I can sort it out for you but you will learn more by doing it yourself. ;)

Go to the plug-ins page and for the glx_if plugin click on “edit”. You will now see a page with the plugin code. Scroll down the page until you see <code>function glx_if_category_list($atts, $thing)</code>. This is the function you are currently using. Just below that you can also see <code>function glx_if_comments_open($atts, $thing)</code> and there will be a blank line immediately above it. Place your cursor in the blank line and hit the “return” key a couple of times to create a bit of extra space. Now into the middle of that space copy /paste this:-

<code>
function glx_if_not_category_list($atts, $thing)
{ global $pretext; return (empty($pretext[“c”])) ? parse($thing) : “”;
}</code>
<br />

then click on the “Save” button underneath the textarea. You should now end up back at the plugins page. Just check that the plugin is still switched on.

We have now created a new tag <code><txp:glx_if_not_category_list></txp:glx_if_not_category_list></code> which I created specifically for this problem. It won’t appear in the “Help” I’m afraid. If you surround the code for your News section with these tags it should disappear from your category listing but still appear on your frontpage.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#11 2005-10-02 15:43:16

Paqui
Member
Registered: 2005-08-16
Posts: 13

Re: txp:popup type=

Hi,

thank you very much for helping :)

I inserted the new function in the plugin, just as you told to do [between function glx_if_category_list($atts, $thing) and function glx_if_comments_open($atts, $thing)], and I saved. I verified: the code is there.

Then I tried to surround the following code [the one which previously did more or less what I wanted, except that it also showed the news from the front page with the articles of the category]
<code>
<txp:article_custom section=“news” />
<txp:glx_if_category_list><txp:article limit=“5” /></txp:glx_if_category_list>
<txp:if_individual_article>
<p>
<txp:link_to_prev><txp:prev_title /></txp:link_to_prev>
<txp:link_to_next><txp:next_title /></txp:link_to_next>
</p>
</txp:if_individual_article>
<txp:if_article_list>
<p>
<txp:older>Previous</txp:older>
<txp:newer>Next</txp:newer>
</p>
</txp:if_article_list>
</code>
with the tags:
<code><txp:glx_if_not_category_list></txp:glx_if_not_category_list></code>
(First tag before the code, last tag behind it.)
Unfortunately, all I see is again blank space instead of the articles belonging to a determined category :(

Should I have inserted the new tags elsewhere?

The best is indeed if I manage to go through it myself – but maybe the problem is elsewhere – not just visible in the couple of lines I copied above. If the mistake is not obvious, it might be easier to mail you a login – no problem.

Thanks again
Paqui

Offline

#12 2005-10-03 14:44:35

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: txp:popup type=

Sorry to take so long. Had a slight problem with my “old” PC. :( No you don’t surround all of it, just that part that relates to “News”. Looking at your code above that would just be the first line only. The second line then deals with the category list view then the rest of the code is common to both.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

Board footer

Powered by FluxBB