Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-06 09:57:59

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

articles only from certain category

My main code for displaying articles on the home page is this:

<txp:article_custom form="default" limit="1" section="recepti" sortby="Posted" sortdir="desc" listform="default" />
<txp:article_custom form="default" limit="1" section="blog" sortby="Posted" sortdir="desc" listform="default" />

You can see that I want one article from one section, and one article from another section to be displayed.

Now I have a problem when I want to see articles only from certain category (by clicking on it’s name), TXP doesn’t know where to show it I guess, so it gives me the home page always. How can I get around this?

(Edit: updated title to something more helpful, fixed code to display properly. :) -Mary)

Last edited by Mary (2006-03-14 20:05:37)

Offline

#2 2006-02-06 10:55:29

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

Re: articles only from certain category

Have a look at this little trick to make category lists use the same page template and section that the link is on.


Stuart

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

Offline

#3 2006-02-06 12:01:23

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

Ooh, that is quite handy! I think it will do the trick, I suppose there is no way that the URI be formed as “clean”?

I have a couple more questions, since I am still in localhost, and on my XAMPP I can’t get clean URIs I always develop the site here, and then import the database on the real server and to the rest of the tweaking there to achieve some finesse, now, in this case I need to go online and test everything pretty soon, and I have a problem.

I have setup my directoryIndex in my .htaccess to be splash.php that holds a subscribe form untill the site goes live. Now, when I want to upload and run TXP regularily with that .htaccess rule, i always get 404s or whatnot, and I think even clean URLs don’t work.

How do I set up my .htaccess so that when people type http://mysite.com get the splash.php as the index, and when I type something else, http://mysite.com/index.php even, I get the real deal?

EDIT:

I have also forgotten one thing, namely when I tell TXP to display category names and automatically make them hyperlinks, what happens is—when I don’t assign a second category TXP outputs an empty anchor and It really annoys me, since they are styled that way and they can be seen. I have fixed this with Sencers asy_showcat plugin, but I’m also interested in getting rid of empty elements, for instance while paginating, when there is no “next” or “previous”
Also, I don’t like having empty elements lying around serveing no purpouse.

Last edited by Dragan (2006-02-06 13:01:03)

Offline

#4 2006-02-06 16:23:19

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: articles only from certain category

I’m also interested in getting rid of empty elements, for instance while paginating, when there is no “next” or “previous”.
Also, I don’t like having empty elements lying around serveing no purpouse.

Would chh_if_data help you with this?

Offline

#5 2006-02-06 16:46:02

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

I will definitely have a look at that plugin doggiez, seems like the perfect solution. Also that asy_showcat plugin didn’t solve my problems, it can’t display category titles, so I’ll just stick with the bombsite’s trick.

Any suggestions on my developing “under the hood” problem with .htaccess???

Offline

#6 2006-02-06 20:15:43

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

Re: articles only from certain category

I think your “development” problem has been discussed elsewhere. If I find it I’ll drop a link in or why don’t you have a go at a search.


Stuart

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

Offline

#7 2006-02-06 21:42:22

igner
Plugin Author
Registered: 2004-06-03
Posts: 337

Re: articles only from certain category

one easy trick is to use a subdomain: dev.yourdomain.com. throw .htpasswd security on the directory, and you’re golden. When you’re ready to deploy, move (or copy) the entire subdirectory, change config.php to reflect the new path to the site, update the site url in the txp prefs (and the file upload path, if desired), and you’ll be up and running.

Of course, this assumes the subdomains are handled in the typical shared server fashion (as subdirectories of the parent domain).


And then my dog ate my badger, and the love was lost.

Offline

#8 2006-02-06 22:30:44

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

oh boy, I have never created a subdomain, how do I do that?

Offline

#9 2006-02-07 00:24:27

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

Re: articles only from certain category

You create a subdirectory and then you should be able to go to your site’s control panel where there should be an option to create a subdomain using your new subdirectory.


Stuart

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

Offline

#10 2006-02-07 00:57:33

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

I expected something along those lines. :)
I am using ensimPro I believe it is called at my host, and I have the cheapest possible account so I don’t know if it is enabled for me. Thanx a lot guys.

Offline

#11 2006-02-07 01:16:30

igner
Plugin Author
Registered: 2004-06-03
Posts: 337

Re: articles only from certain category

If I recall correctly, Ensim has an easy function to enable subdomains. And in most cases, it’s not even necessary to create the directory first.

Good luck, and have fun.


And then my dog ate my badger, and the love was lost.

Offline

#12 2006-02-07 11:01:09

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

Re: articles only from certain category

With regard to my “litle trick” above, I have tried it using /category/ as I use “clean” URLs myself but it throws a 404. I think the addition of the section to the URL is the problem.


Stuart

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

Offline

Board footer

Powered by FluxBB