Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#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
- )
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
#25 2006-07-19 08:33:24
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: General guidance on static site structure
What do your page tags look like?
Offline
#26 2006-07-19 22:54:02
- dimfish
- Member
- Registered: 2006-06-01
- Posts: 72
Re: General guidance on static site structure
Not sure I know what you mean Mary, sorry. Can you explain?
Offline
#27 2006-07-20 02:19:07
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: General guidance on static site structure
Sorry. Your page’s tags (as opposed to your forms’ tags), what are you using?
Offline
#28 2006-07-20 08:09:04
- dimfish
- Member
- Registered: 2006-06-01
- Posts: 72
Re: General guidance on static site structure
Ah. I’m using this to deliver my main content:
<code>
<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>
</code>
Form artorlist is:
<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>
And sectionpage form is:
<code>
<h2><txp:title /></h2>
<txp:body />
</code>
Offline