Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-05-24 04:36:21

sonoramark
New Member
Registered: 2006-05-19
Posts: 9

Confused about sections

I’m unclear on what a section really is, and what a section URL is.

The FAQ says that sections “usually correspond to URLs such as http://example.com/politics/”. This seems to agree with what is generated by the txp:breadcrumb tag, which I would assume provides a breadcrumb trail of sections.

However, when I create a section in the admin interface, no corresponding directory in the document root is created. Furthermore, using txp:popup with type set to “s” produces a drop down list of sections I have created, and I can naviate to those sections, but the URL is of the form “http://example.com?s=politics”.

So which is a section? A directory with the associated URL, or a database attribute with “?s=” appended to the URL? If the former, then why does txp:popup behave the way it does, and why doesn’t creating a section in the admin interface create a corresponding directory? If the latter, then why doesn’t the FAQ say this, and why does txp:breadcrumb behave the way it does?

I’m sure I’m being incredibly dense about this and missing something obvious, but I’m confused.

-Mark Stone

Offline

#2 2006-05-24 05:03:15

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Confused about sections

Hi Mark,

TXP sections are an abstraction used to organize your site and it doesn’t necessarily map through to subdirectories under the site root because the “pages” (so called) are generated on-the-fly by TXP’s php code.

Your question about the “?=” is a good one, and I think it is because your TXP installation is set for what is called messy URLs but the example you quoted is set for the newer, ‘clean URLs’.

If you log into your TXP admin interface and go to the admin -> preferences then you should see an option called “Permanent link mode” I think you have it set to “messy”.

Destry wrote a really good article about Textpattern building blocks that helped me understand much more about how a site is organized when I started out with TXP. Highly recommended reading.

Hope this helps some!

Edit: You could also try this article from the textbook.

Last edited by net-carver (2006-05-24 05:21:28)


Steve

Offline

#3 2006-05-24 17:39:39

sonoramark
New Member
Registered: 2006-05-19
Posts: 9

Re: Confused about sections

net-carver wrote:

Hi Mark,

TXP sections are an abstraction used to organize your site and it doesn’t necessarily map through to subdirectories under the site root because the “pages” (so called) are generated on-the-fly by TXP’s php code.

Your question about the “?=” is a good one, and I think it is because your TXP installation is set for what is called messy URLs but the example you quoted is set for the newer, ‘clean URLs’.

If you log into your TXP admin interface and go to the admin -> preferences then you should see an option called “Permanent link mode” I think you have it set to “messy”.

Yes, I get the abstraction idea; I’m well acquainted with dynamic site design. In fact my settings were not set to “messy”; I remember changing this when I first did the install, and I double-checked again and my permanent link mode was set to “section/id/title”.

I’ve done some tinkering since then, and here’s what I’ve found:

  • the txp:popup tag in my install only supports messy links;
  • the txp:breadcrumb tag changes to whatever link style I set in admin:permanent link
  • my install seems to only support messy links, and I’ve no idea why – in other words, txp:breadcrumb is broken and clicking on breadcrumb links returns a “404” if admin:permanent link is set to anything other than messy

This doesn’t seem like the desired or correct behavior, but I’m not sure what I’m doing wrong.

Destry wrote a really good article about Textpattern building blocks that helped me understand much more about how a site is organized when I started out with TXP. Highly recommended reading.

Yes, that article is a good read, although it covers a lot of stuff I already know, and doesn’t help me resolve my current dilemma. Definitely will be a useful article when I get done kicking the tires and working the kinks out and I’m ready to start building something out.

-Mark Stone

Offline

#4 2006-05-24 18:11:33

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Confused about sections

Mark wrote:

Yes, I get the abstraction idea; I’m well acquainted with dynamic site design.

Sorry for pitching that wrong!

my install seems to only support messy links, and I’ve no idea why – in other words, txp:breadcrumb is broken and clicking on breadcrumb links returns a “404” if admin:permanent link is set to anything other than messy

Ok, clean urls need the rewrite module to be turned on. Have you checked your htaccess file?


Steve

Offline

#5 2006-05-24 18:41:32

sonoramark
New Member
Registered: 2006-05-19
Posts: 9

Re: Confused about sections

net-carver wrote:

Ok, clean urls need the rewrite module to be turned on. Have you checked your htaccess file?

Well, I’m making progress. Problem isn’t solved yet, but I’m getting there. What you say above is essentially correct, but a bit terse. For those that may have a similar problem:
  • The initial problem is not with Textpattern or PHP, but with Apache. You have to have mod_rewrite enabled as an Apache module, and on Debian-based systems, presumably for security reasons, it is not enabled by default. This textpattern article is the one that tipped me off, and beginners having problems with clean URLs should probably be directed immediately to this article.
  • On my Ubuntu system, mod_rewrite can be enabled and activated with the following two commands:
    • sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
    • sudo apache2ctl restart
  • Sadly, these steps did not suffice to solve the problem for me. I suspect I need to add or change a RewriteRule line in the .htaccess file of my document root. The aforementioned textpattern article alludes to this, but, sadly, that chunk of the article hasn’t been written yet, so I don’t know what to do at this point.

-Mark Stone

Offline

#6 2006-05-24 20:37:26

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

Re: Confused about sections

Have you checked this thread? You might find something there.

Offline

#7 2006-05-25 02:57:33

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Confused about sections

Mark,

there is some information about getting your .htaccess file together in the faq

Do you get any warnings or errors when you go to your TXP installation and look at the “Pre-flight check” section on the admin -> diagnostics tab?

<guess>It might be that you need to do something like enable symbolic links.</guess>


Steve

Offline

#8 2006-05-25 18:47:54

sonoramark
New Member
Registered: 2006-05-19
Posts: 9

Re: Confused about sections

net-carver wrote:

there is some information about getting your .htaccess file together in the faq

I hadn’t found my way to that part of the FAQ, and it was helpful to read, so thanks for the pointer.

Do you get any warnings or errors when you go to your TXP installation and look at the “Pre-flight check” section on the admin -> diagnostics tab?

No, all of that checked out just fine.

<guess>It might be that you need to do something like enable symbolic links.</guess>

OK: I’ve done several things today, and I’m pretty sure it took all of them to get things working. The good news is that I do have clean URLs working now. Woohoo! Here’s what I did:
  • Uncomment these three lines in .htaccess:
    • DirectoryIndex index.php index.html
    • Options +FollowSymLinks
    • RewriteBase /[textpattern directory name]/
  • Add the following lines to my Apache conf file:
    • <Directory /var/www/[textpattern directory name]>
    • AllowOverride All
    • </Directory>

This is in addition to the previous steps of configuring Apache to load mod_rewrite.

The lesson from all of this: Debian-based distributions (Ubuntu, in my case) ship with the most conservative security options possible for the default Apache configuration, and you’ll need to change all of these things to get clean URLs to work.

On a side note: the level of support and responsiveness this forum has provided me has been just fantastic. Textpattern felt like the right tool for my needs when I first started looking at it, but the fact that there’s this kind of community behind it is just as important in selling me on Textpattern.

(Steve: Are you really in Borneo?)

-Mark Stone

Offline

#9 2006-05-25 23:47:07

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Confused about sections

Hi Mark,

good to hear that you managed to wade through the apache configuration: Welcome to TXP!

And yes, I am really in Borneo.


Steve

Offline

Board footer

Powered by FluxBB