Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2008-08-14 16:46:45

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: How to identify all major page types in the default page template?

Just for the record: two ways to move search/categories out from the default template.

Make a category listing use the same section
Using search in TXP (it’s old, but it still works if I’m not wrong)

@kkobashi: an advice: stay away from the “One page template to rule ‘em all” obsession. I understand you are trying to learn, and you seem to be someone adventurous, and probably, have all the necessary knowledge and guts to go through that path and find the Holy Grail of TXP default page template.

Anyway, TXP is incomplete, then you complete it with plug-ins or raw black php magic.

BTW, if you evaluate TXP and finally decide not to use it, don’t forget to come back after you’ve found the Complete CMS out there in the wild. ;)

@Gocom, don’t forget to take your pills and play Wii the total amount of hours the doctor said.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#14 2008-08-14 21:13:53

kkobashi
Member
Registered: 2008-01-27
Posts: 51
Website

Re: How to identify all major page types in the default page template?

I find it interesting that noone has come up with the answer to my question. And I love it when someone tells me that I can’t do something. That just gets me fired up even more.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<txp:lang/>" lang="<txp:lang/>">

<txp:kob_page_type_if_homepage>
  <txp:output_form form="home"/>
</txp:kob_page_type_if_homepage>

<txp:kob_page_type_if_search_homepage>
  <txp:output_form form="search"/>
</txp:kob_page_type_if_search_homepage>

<txp:kob_page_type_if_author_homepage>
  <txp:output_form form="authors"/>
</txp:kob_page_type_if_author_homepage>

<txp:kob_page_type_if_author_page>
  <txp:output_form form="author"/>
</txp:kob_page_type_if_author_page>

<txp:kob_page_type_if_section_homepage>
  <txp:output_form form="section"/>
</txp:kob_page_type_if_section_homepage>

<txp:kob_page_type_if_category_homepage>
  <txp:output_form form="category"/>
</txp:kob_page_type_if_category_homepage>

<txp:kob_page_type_if_article_page>
  <txp:output_form form="article"/>
</txp:kob_page_type_if_article_page>

<txp:kob_page_type_if_nopagetype>
  <txp:output_form form="unknownpagetype"/>
</txp:kob_page_type_if_nopagetype>

</html>

The above is my default page template.

<head>
<title><txp:site_name/> | <txp:site_slogan/></title>
<meta name="description" content="Kobashi Computing is a Silicon Valley consulting company specializing in software/web development and testing." />
<meta name="keywords" content="Kobashi Computing, Silicon Valley consulting, software development, web development, software testing"/>
<meta http-equiv="Content-Language" content="<txp:lang/>" />
<meta name="robots" content="index, follow" />

<link rel="stylesheet" type="text/css" href="/themes/techno/reset.css"/>
<link rel="stylesheet" type="text/css" href="/themes/techno/global.css"/>
<link rel="stylesheet" type="text/css" href="/themes/techno/home.css"/>
</head>

<body id="home">
<div id="page">
  <txp:output_form form="header"/>
  <txp:output_form form="navbar"/>
  <txp:output_form form="breadcrumb"/>

  <div id="content">
    <h2>Welcome</h2>
  </div>

  <txp:output_form form="footer"/>
</div>
</body>

The above is a sample of the home page

<head>
<title><txp:site_name/> | <txp:category title="1"/></title>
<meta name="description" content="<txp:category title="1"/>" />
<meta name="keywords" content="<txp:category title="1"/>"/>
<meta http-equiv="Content-Language" content="<txp:lang/>" />
<meta name="robots" content="index, follow" />

<link rel="stylesheet" type="text/css" href="/themes/techno/reset.css"/>
<link rel="stylesheet" type="text/css" href="/themes/techno/global.css"/>
<link rel="stylesheet" type="text/css" href="/themes/techno/category.css"/>
</head>

<body id="category">
<div id="page">
  <txp:output_form form="header"/>
  <txp:output_form form="navbar"/>
  <txp:output_form form="breadcrumb"/>

  <div id="content">
    <h2><txp:category title="1"/></h2>
  </div>

  <txp:output_form form="footer"/>
</div>
</body>

The above is a sample of the category page

I’d say this is pretty damn clean. Doesnt look like much in the pages does it. The magic is in the plug in to get it to the right page template.

But I wont be releasing the plugin until I’ve tested this more. I’m also considering making this as easy as a one line tag call by moving all if processing to the plugin.

Last edited by kkobashi (2008-08-14 23:12:22)


Kerry Kobashi
Kobashi Computing

Offline

#15 2008-08-14 22:32:49

kkobashi
Member
Registered: 2008-01-27
Posts: 51
Website

Re: How to identify all major page types in the default page template?

Oh boy, I now have the default template down to one line. All the if processing is moved into the template and it will now detect what page type is being requested (author home page, authors home page, category home page, article, section home page, search home page, etc.) and then pull in the right form.

The form is now essentially a document wrapper for a page type.

<txp:kob_smart_page_route/>

Last edited by kkobashi (2008-08-14 23:16:24)


Kerry Kobashi
Kobashi Computing

Offline

#16 2008-09-02 16:10:12

nemoorange
Plugin Author
From: Washington DC
Registered: 2006-11-29
Posts: 90
Website

Re: How to identify all major page types in the default page template?

Currently, I think Bloke’s proposal is the only valid solution to separating the different functions of the default page. The whole nested if conditionals gets way too messy considering the default page template has to account for various different functions:

  • search results page
  • category results page
  • author results page
  • and the front page layout.

I can argue that article list and individual article layouts should be handled by using a different page template for the specific sections. Even still, Those four sections (search, category, author, front page) are distinct enough that they should have a default section/page already assigned to them. Or at least a way to assign a different section to be used.

rss_unlimited_categories handles this fairly well with its linktosection attribute. It would be great to have this linktosection attribute for <txp:author /> and the others tags.

I thought there was a plug in out there to define a different section for search – anybody know what I’m talking about?


Txp admin themes | dropshado.ws – a blog for design noobs like me

Offline

#17 2008-09-02 16:29:10

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: How to identify all major page types in the default page template?

Hi nemoorange:

check my post on this same thread.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#18 2008-09-03 00:18:25

nemoorange
Plugin Author
From: Washington DC
Registered: 2006-11-29
Posts: 90
Website

Re: How to identify all major page types in the default page template?

maniqui – thank you! While the category fix is a hack, the search fix works great. I’m ashamed I didn’t of it previously.


Txp admin themes | dropshado.ws – a blog for design noobs like me

Offline

#19 2008-09-03 05:57:50

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: How to identify all major page types in the default page template?

nemoorange wrote:

…category fix is a hack…

Nope, not exactly but depends on what you mean by hacking. It just is pasting and tossing TXP tags around, like we all usually do.

Also the search form can be fully customized by just making the XHTML different: it is just a static form.

Offline

Board footer

Powered by FluxBB