Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2006-07-16 08:46:24

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

Ah. I do use an overide form on that and some other articles simply to get around the problem that some of my articles have the same title as the category (I’m sure that’s dodgy practice!) and it means I can display or not display the title, but still use just the one page.

So whereas usually my page is using
<code>
<div id=“content”>

<h1><txp:section title=1 /></h1>

<txp:if_category>

<!— we’re looking at a category list —> <txp:article form=“artorlist” />

<txp:else />

<!— we’re looking at the section list —> <txp:article limit=“1” form=“sectionpage” />

</txp:if_category>

</div>
</code>

…I sometimes overide it using <code>artorlist2</code> which just doesn’t display article title (since the cat name is already displayed and they are the same).

Offline

#14 2006-07-16 19:44:05

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: General guidance on static site structure

Okay, change this:

<txp:article limit="1" form="set_category" />

to this:

<txp:article limit="1" form="set_category" allowoverride="0" />

:)

Offline

#15 2006-07-16 21:16:43

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

Hey Mary,
Well, it’s showing the correct active class when you first land on a section page, hurrah! …. but the way the articles are displayed is messed with now. It seems to be showing a list of all articles (title+excerpt) when you land on a section page, rather than displaying the most recent article alone….

Offline

#16 2006-07-16 22:40:18

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: General guidance on static site structure

Ah yes. Okay…

<div id="sidebar-1">
<txp:article limit="1" form="set_category" allowoverride="0" />
<txp:output_form form="subnavmenu2" />
<txp:output_form form="reset_category" />
</div>

set_category

<txp:php>

global $c, $this_article; 

$old_cat = $c;

$c = $thisarticle['category1'];

</txp:php>

reset_category

<txp:php>

global $c, $old_cat; 

$c = $old_cat;

</txp:php>

How’s that?

Last edited by Mary (2006-07-17 00:44:39)

Offline

#17 2006-07-16 22:51:20

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

Oooo sounded nice Mary, but sadly doesn’t quite do it.
Getting the article in the sidebar again

|

I really appreciate your help Mary…

Offline

#18 2006-07-17 00:45:08

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: General guidance on static site structure

Whoops, sorry, forgot that allowoverride attribute. Try again?

Offline

#19 2006-07-17 08:01:16

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

You’re a sure-fire genius Mary. Works just as I wanted. Thanks a billion.
)

Offline

#20 2006-07-17 08:06:49

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

Ah…oh….except that it seems the categories that are more than one article ie list of articles (title/excerpt) are not showing now (see the What are we doing? category), just the first article is showing…..hmmm….

You’ve lost me a bit now Mary so if you can see why…well, genius status will be upgraded.

Offline

#21 2006-07-17 09:46:14

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: General guidance on static site structure

According to the output (view source):

<!-- we've got an article which is both the first and last article, -->
<!-- which means there's only one -->

there’s only that one article in that category and section. If there should be more than that, then check and make sure that the other articles match the correct category and section, and that they have the “live” status. If they do, put debugging back on and let’s see what’s happening. :)

Last edited by Mary (2006-07-17 09:46:30)

Offline

#22 2006-07-18 22:50:35

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

Hi Mary. I’m back again.

Is debugging <code><!— etc —></code>? If so I think I have put it back on. In Madagascar section, the categories What are we doing? and Why are we here? have more than one article (have checked them, posted and tagged correctly) so shd appear as a title+excerpt linked list.

Here’s how form artorlist looks:

<code>

<txp:if_first_article>

<txp:if_last_article>

<!— we’ve got an article which is both the first and last article, —> <!— which means there’s only one —>

<h2><txp:category1 title=“1” /></h2>

<txp:body />

<txp:else />

<!— there’s a list, and this is the first one, —> <!— so include the category title —>

<h2><txp:category1 title=“1” /></h2> <h3><txp:permlink><txp:title /></txp:permlink></h3> <txp:excerpt />

</txp:if_last_article>

<txp:else />

<!— there’s a list, and this isn’t the first article —>

<h3><txp:permlink><txp:title /></txp:permlink></h3>

<txp:excerpt />

</txp:if_first_article>

</code>

Any ideas what might be wrong?

Last edited by dimfish (2006-07-18 22:51:20)

Offline

#23 2006-07-19 07:44:25

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: General guidance on static site structure

Is debugging <!-- etc -->?

Admin prefs, production status, “debugging”. It’d start something like:

<!-- Runtime:    0.0425 -->
<!-- Query time: 0.005178 -->
<!-- Queries: 14 -->
<!-- Memory: 2244Kb, <txp:permlink /> -->
<!-- txp tag trace: 

Post a tag trace, please.

Last edited by Mary (2006-07-19 07:44:33)

Offline

#24 2006-07-19 08:00:56

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

Gotcha. Thanks Mary.

Here’s the tag trace:
<code>
<!— txp tag trace:
[SQL (0.000259): select name from `txp_lang` where lang=‘en-gb’ limit 1]
[SQL (0.012498): select name, data from `txp_lang` where lang=‘en-gb’ AND ( event=‘public’ OR event=‘common’)]
[SQL (0.001443): select name, code from `txp_plugin` where status=‘1’]
[SQL (0.000288): select title from `txp_section` where name=‘madagascar’]
[SQL (0.000142): select name from `txp_section` where `name` like ‘madagascar’ limit 1]
[SQL (0.000149): select * from `txp_section` where name = ‘madagascar’ limit 1]
[SQL (0.000188): select host from `txp_log` where ip=‘82.12.247.200’ limit 1]
[SQL (0.000237): insert into `txp_log` set `time`=now(),page=’/rdtxptest/madagascar/?c=what-are-we-doing’,ip=‘82.12.247.200’,host=‘client-82-12-247-200.brnt.adsl.virgin.net’,refer=’‘,status=‘200’,method=‘GET’]
[SQL (0.000134): select user_html from `txp_page` where name=‘rd2col’]
[Page: rd2col]
<txp:css/>
<txp:page_title/> [SQL (0.000197): select title from `txp_category` where name=‘what-are-we-doing’ and type=‘article’]
<txp:article_custom form=“fact” limit=1 category=“fact” status=“sticky” /> [SQL (0.000956): select *, unix_timestamp(Posted) as uPosted from `textpattern` where 1 and Status=‘5’ and Posted < now() and ((Category1=‘fact’) or (Category2=‘fact’)) order by Posted desc limit 0, 1] [SQL (0.000124): select Form from `txp_form` where `name` = ‘fact’ limit 1] [Form: fact] [article 14]
<txp:output_form form=“nav-bar” /> [SQL (0.000118): select form from `txp_form` where `name` = ‘nav-bar’ limit 1] <txp:ako_nav name=“Home,ReefDoctor,Madagascar,Joining up,Science,Resources,News,Photos,Links,ReefDoctor Trust” url=”/,/reefdoctor,/madagascar,/joinup,/science,/resources,/news,/photos,/links,/trust” headon=“0” divid=“navlist” />
<txp:category/>
<txp:article limit=“1” form=“set_category” allowoverride=“0” /> [SQL (0.001393): select count(*) from `textpattern` where 1 and Status=‘4’ and Posted < now() and ((Category1=‘what-are-we-doing’) or (Category2=‘what-are-we-doing’)) and Section = ‘madagascar’] [SQL (0.000680): select *, unix_timestamp(Posted) as uPosted from `textpattern` where 1 and Status=‘4’ and Posted < now() and ((Category1=‘what-are-we-doing’) or (Category2=‘what-are-we-doing’)) and Section = ‘madagascar’ order by Posted desc limit 0, 1] [SQL (0.000562): select Form from `txp_form` where `name` = ‘set_category’ limit 1] [Form: set_category] [article 18] <txp:permlink> </txp:permlink> <txp:php> </txp:php>
<txp:category/>
<txp:output_form form=“subnavmenu2” /> [SQL (0.000131): select form from `txp_form` where `name` = ‘subnavmenu2’ limit 1] <txp:cbs_category_list title=1 wraptag=“ul” break=“li” activeclass=“active” /> [SQL (0.001726): SELECT c.name, c.title FROM `txp_category` AS c, `textpattern` AS t WHERE (c.name = t.Category1 OR c.name = t.Category2) AND c.type = ‘article’ AND t.Section = ‘madagascar’ AND t.Posted < now() AND t.Status = 4 GROUP BY c.name ORDER BY c.position]
<txp:category/>
<txp:output_form form=“reset_category” /> [SQL (0.000167): select form from `txp_form` where `name` = ‘reset_category’ limit 1] <txp:php> </txp:php>
<txp:category/>
<txp:section title=1 /> [SQL (0.000119): select title from `txp_section` where name=‘madagascar’]
<txp:if_category> [<txp:if_category>: false] <txp:article limit=“1” form=“sectionpage” /> [SQL (0.000946): select count(*) from `textpattern` where 1 and Status=‘4’ and Posted < now() and ((Category1=‘what-are-we-doing’) or (Category2=‘what-are-we-doing’)) and Section = ‘madagascar’] [SQL (0.000632): select *, unix_timestamp(Posted) as uPosted from `textpattern` where 1 and Status=‘4’ and Posted < now() and ((Category1=‘what-are-we-doing’) or (Category2=‘what-are-we-doing’)) and Section = ‘madagascar’ order by Posted desc limit 0, 1] [SQL (0.000132): select Form from `txp_form` where `name` = ‘sectionpage’ limit 1] [Form: sectionpage] [article 18] <txp:permlink> </txp:permlink> [SQL (0.000141): select Form from `txp_form` where `name` = ‘artorlist2’ limit 1] [Form: artorlist2] <txp:if_first_article> [<txp:if_first_article>: true] <txp:if_last_article> [<txp:if_last_article>: true] <txp:category1 title=“1” /> <txp:title/> <txp:body/> </txp:if_last_article> </txp:if_first_article>
</txp:if_category>
<txp:output_form form=“footer” /> [SQL (0.000132): select form from `txp_form` where `name` = ‘footer’ limit 1]
[ —- secondpass —- ] —>
</code>

Offline

Board footer

Powered by FluxBB