Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-05-14 22:25:47
- ABL
- Member
- Registered: 2010-03-08
- Posts: 17
Executive Bios with list--What a mess I've made!
I am finishing up a site (well, as soon as this is done!) in which I have a section, execs, which has a list of [firstname]” “[lastname] execs down the left hand side (with the head honcho up top and all others sorted alpha by lastname, and a bio in the center.
I can create the list, but I can’t display the bio for some reason (they are all static page “articles”).
Of course, when an exec is selected (or on the landing page, when it is the head honcho), that list item should not be a link and should have a different format.
To confound things further, above the list and bio should be
<< Previous Profile Next Profile >>
and, Previous should not appear if the head honcho’s bio is up, nor should Next if the last person’s bio is up.
This may be easy, but I’ve been banging my head against the wall for some time now, and I seem to be getting further from the answer. Any help would be appreciated.
More info:
I use custom field 1 to put the last name in for sorting purposes (the boss is “AAAA”)
I do realize that I am sorting AFTER the links for <txp:link_to_prev> and <txp:link_to_next>, but how do I do it without showing the list first (I tried adding this to the top: <txp:article status=“5” limit=“50” form=“empty_list” section=“execs” sort=“custom_1 asc” />, but that didn’t seem to help)?
The relevant code (I hope!) is:
<table width=“875” border=“0” cellspacing=“2” cellpadding=“0”> <tr> <td align=“left” valign=“top”><p class=“text”><strong><img src=”/images/__execs.gif” alt=“about Co.” width=“300” height=“29” /></strong></p> </td> </tr> <tr> <td height=“157” align=“center” valign=“top”>
<table width=“875” border=“0” cellspacing=“7” cellpadding=“0”> <tr> <td align=“left” valign=“middle”><txp:link_to_prev><< Previous Profile</txp:link_to_prev> </td> <td align=“right” valign=“middle”> </td> <td align=“right” valign=“middle”><txp:link_to_next>Next Profile >></txp:link_to_next> </td> </tr> <tr> <td width=“200” align=“left” valign=“top”><div align=“left” class=“textsmall2”>
<!—Put sidebar of execs here, with Previous, Next, then head honcho FIRST—>
<txp:article status=“5” limit=“50” section=“execs” form=“exec_list” sort=“custom_1 asc” />
</div></td> <td align=“right” valign=“top”>
<!—Put bio here—>
<txp:article form=“bio” section=“execs” /> </div></td> </tr> </table></td> </tr> </table>
The form: exec_list is: <txp:permlink><txp:title /></txp:permlink><br />
The form bio is just: <txp:body />
Any help would be greatly appreciated!
Thank you.
Last edited by ABL (2010-05-14 23:40:48)
Offline
#2 2010-05-15 01:19:34
- ABL
- Member
- Registered: 2010-03-08
- Posts: 17
Re: Executive Bios with list--What a mess I've made!
Okay. After puzzling over this and re-checking “How-tos and Examples”, I found the following thread:
another way to build static/dynamic ‘sub nav’
So, now, I can change the active link. I can now display the proper bio. However, I still cannot display Previous and Next properly.
The latest code is:
<table width="875" border="0" cellspacing="7" cellpadding="0">
<tr>
<td align="left" valign="middle"><txp:link_to_prev><< Previous Profile</txp:link_to_prev> </td>
<td align="right" valign="middle"> </td>
<td align="right" valign="middle"><txp:link_to_next>Next Profile >></txp:link_to_next> </td>
</tr>
<tr>
<td width="200" align="left" valign="top"><div align="left" class="textsmall2">
<!--Put sidebar of execs here, with Previous, Next, then head honcho FIRST-->
<txp:article_custom status="5" limit="999" section="execs" form="exec_list" sort="custom_1 asc" />
</div></td>
<td align="right" valign="top">
<!--Put bio here-->
<txp:article form="bio" section="execs" status="sticky" limit="1" sort="custom_1 asc" />
</div></td>
</tr>
</table></td>
</tr>
</table>
The form: exec_list is now:
<txp:rvm_if_this_article><span class="active"><txp:title /></span><txp:else />
<a href="<txp:permlink />"><txp:title /></a>
</txp:rvm_if_this_article><br />
The form bio is still: <txp:body />
NB: I am using the plugin: rvm_if_this_article to indicate the current article.
Last edited by ABL (2010-05-15 01:23:06)
Offline
#3 2010-05-17 20:51:43
- ABL
- Member
- Registered: 2010-03-08
- Posts: 17
Re: Executive Bios with list--What a mess I've made!
So, I changed the nav (which is a misc form that I include in all pages), so that “Executives” links directly to the page for the head honcho. I still don’t have Previous and Next links working. Any help would be greatly appreciated.
The (I believe) relevant code is:
<td align="left" valign="middle"><txp:link_to_prev><< Previous Profile</txp:link_to_prev> </td>
<td align="right" valign="middle"> </td>
<td align="right" valign="middle"><txp:link_to_next>Next Profile >></txp:link_to_next> </td>
Last edited by ABL (2010-05-17 20:54:05)
Offline
#4 2010-05-17 21:31:12
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Executive Bios with list--What a mess I've made!
Hi ABL, sorry for overlooking your topic. You always need a <txp:article />
tag before the navigation tags to make them work. Use the attribute pgonly="1"
to make sure that no article(s) is/are displayed.
This article on thresholdstate.com, about the search in Txp, has a concise and clear explanation of the use of pgonly
.
Offline
#5 2010-05-17 23:43:14
- ABL
- Member
- Registered: 2010-03-08
- Posts: 17
Re: Executive Bios with list--What a mess I've made!
Els,
Thank you for your response. I had tried to put <txp:article /> at the top, but it didn’t seem to help. I actually put: <txp:article status=“5” limit=“50” form=“empty_list” section=“execs” sort=“custom_1 asc” />
there, but it didn’t work.
After I received your response, I tried again, using pgonly="1"
as well, but it didn’t fix the problem. Oddly, even with pgonly="1"
, if I don’t put form="empty list"
, I get the same bio above the list and bio display.
The current code for the Previous and Next reads:
<tr><txp:article status="5" limit="999" section="execs" form="empty_list" sort="custom_1 asc" pgonly="1" />
<td align="left" valign="middle"><txp:link_to_prev>Previous Profile</txp:link_to_prev></td>
<td align="right" valign="middle"> </td>
<td align="right" valign="middle"><txp:link_to_next>Next Profile</txp:link_to_next></td>
</tr>
It looks like link_to_prev and link_to_next are not capturing the correct items.
Any further help would be appreciated.
Thank you!
—Alden
Last edited by ABL (2010-05-17 23:46:14)
Offline
#6 2010-05-18 07:03:55
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Executive Bios with list--What a mess I've made!
Ah, then you are probably using the tags in article list context. <txp:link_to_prev> and <txp:link_to_next> only work on an individual article page. For article lists you need <txp:older> and <txp:newer>.
If you need both situations, you could do something like this:
<tr><txp:article status="5" limit="999" sort="custom_1 asc" pgonly="1" />
<txp:if_individual_article>
<td align="left" valign="middle"><txp:link_to_prev>Previous Profile</txp:link_to_prev></td>
<td align="right" valign="middle"> </td>
<td align="right" valign="middle"><txp:link_to_next>Next Profile</txp:link_to_next></td>
<txp:else />
<td align="left" valign="middle"><txp:older>Previous Profiles</txp:older></td>
<td align="right" valign="middle"> </td>
<td align="right" valign="middle"><txp:newer>Next Profiles</txp:newer></td>
</txp:if_individual_article>
</tr>
If you are only using the article list, just replace your link_to_prev/link_to_next tags with older/newer.
BTW the section
attribute in <txp:article />
is not necessary, and does not even work. <txp:article />
is context sensitive and, when on a section page, will only display articles from that section.
Offline
#7 2010-05-18 13:25:59
- ABL
- Member
- Registered: 2010-03-08
- Posts: 17
Re: Executive Bios with list--What a mess I've made!
Els,
Thank you for the advice. Oddly, when I replace my code with yours, I get a copy of the current bio (with default formatting) above the listing and the bio. On the landing page, I get ALL of the bios with default formatting, followed by the listing and the first bio.
I will post more of the code here, in case I’ve made another mistake that is causing this.
<table width="875" border="0" cellspacing="7" cellpadding="0">
<tr><txp:article status="5" limit="999" sort="custom_1 asc" pgonly="1" />
<txp:if_individual_article>
<td align="left" valign="middle"><txp:link_to_prev>Previous Profile</txp:link_to_prev></td>
<td align="right" valign="middle"> </td>
<td align="right" valign="middle"><txp:link_to_next>Next Profile</txp:link_to_next></td>
<txp:else />
<td align="left" valign="middle"><txp:older>Previous Profiles</txp:older></td>
<td align="right" valign="middle"> </td>
<td align="right" valign="middle"><txp:newer>Next Profiles</txp:newer></td>
</txp:if_individual_article>
</tr>
<tr>
<!--LIST OF EXECS-->
<td width="200" align="left" valign="top"><div align="left" class="textsmall2">
<txp:article_custom status="5" limit="999" form="exec_list" sort="custom_1 asc" /></td>
<!--BIOS-->
<td valign=top>
<txp:article form="bio" section="execs" status="sticky" limit="1" sort="custom_1 asc" />
</div></td>
</tr>
</table>
Offline
#8 2010-05-18 16:48:45
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Executive Bios with list--What a mess I've made!
Can you please post a tag trace of the page in question? It’s hard to tell what the problem is if we can see only part of your code.
Offline
#9 2010-05-18 17:06:28
- ABL
- Member
- Registered: 2010-03-08
- Posts: 17
Re: Executive Bios with list--What a mess I've made!
Here goes (I’m also willing to post all of the code: the page and forms I use—just let me know, please):
<!-- Runtime: 0.0264 -->
<!-- Query time: 0.016776 -->
<!-- Queries: 19 -->
<!-- Memory: 2407Kb, <txp:output_form form="footer" /> -->
<!-- txp tag trace:
[SQL (0.0014281272888184): select name, data from txp_lang where lang='en-us' AND ( event='public' OR event='common')]
[SQL (0.00173020362854): select name, code, version from txp_plugin where status = 1 AND type IN (0,1) order by load_order]
[SQL (0.0006098747253418): select ID,Section from textpattern where url_title like 'marieka-baily' AND Section='execs' and Status >= 4 limit 1]
[SQL (0.00063204765319824): select page, css from txp_section where name = 'execs' limit 1]
[SQL (0.00081610679626465): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where ID=13 and Status in (4,5)]
[article 13]
[SQL (0.0011489391326904): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted > '2010-05-14 11:01:32' and Section = 'execs' and Status=4 and Posted < now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') order by Posted asc limit 1]
[SQL (0.0011279582977295): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where Posted < '2010-05-14 11:01:32' and Section = 'execs' and Status=4 and Posted < now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') order by Posted desc limit 1]
[SQL (0.001101016998291): select host from txp_log where ip='208.109.80.101' limit 1]
[SQL (0.001107931137085): insert into txp_log set `time`=now(),page='/execs/marieka-baily',ip='208.109.80.101',host='p3prvwproxy001.prod.phx3.secureserver.net',refer='',status='200',method='GET']
[SQL (0.00084018707275391): select user_html from txp_page where name='execs']
[Page: execs]
<txp:output_form form="main_nav" />
[SQL (0.00048685073852539): select Form from txp_form where name='main_nav']
[Form: main_nav]
<txp:if_section name="default">
[<txp:if_section name="default">: false]
</txp:if_section>
<txp:if_section name="about">
[<txp:if_section name="about">: false]
</txp:if_section>
<txp:if_section name="services">
[<txp:if_section name="services">: false]
</txp:if_section>
<txp:if_section name="clients">
[<txp:if_section name="clients">: false]
</txp:if_section>
<txp:if_section name="contact">
[<txp:if_section name="contact">: false]
</txp:if_section>
<txp:if_section name="execs">
[<txp:if_section name="execs">: true]
</txp:if_section>
<txp:if_section name="featured">
[<txp:if_section name="featured">: false]
</txp:if_section>
<txp:if_section name="forclients">
[<txp:if_section name="forclients">: false]
</txp:if_section>
<txp:article status="5" limit="999" sort="custom_1 asc" pgonly="1" />
[SQL (0.00074195861816406): select Form from txp_form where name='default']
[Form: default]
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:permlink>
<txp:title />
</txp:permlink>
</txp:if_individual_article>
<txp:posted />
<txp:body />
<txp:author />
[SQL (0.001046895980835): select RealName from txp_users where `name` = 'alden' limit 1]
<txp:category1 title="1" link="1" />
<txp:category2 title="1" link="1" />
<txp:comments_invite wraptag="p" />
<txp:image id="1" />
[SQL (0.00077605247497559): select * from txp_image where id = 1 limit 1]
<txp:if_individual_article>
[<txp:if_individual_article>: true]
<txp:link_to_prev>
</txp:link_to_prev>
<txp:link_to_next>
</txp:link_to_next>
</txp:if_individual_article>
<txp:article_custom status="5" limit="999" section="execs" form="exec_list" sort="custom_1 asc" />
[SQL (0.0013179779052734): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 5 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and Section IN ('execs') order by custom_1 asc limit 0, 999]
[article 12]
[SQL (0.00035905838012695): select Form from txp_form where name='exec_list']
[Form: exec_list]
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
</txp:rvm_if_this_article>
[article 13]
[Form: exec_list]
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: true]
<txp:title />
</txp:rvm_if_this_article>
[article 14]
[Form: exec_list]
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
</txp:rvm_if_this_article>
[article 15]
[Form: exec_list]
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
</txp:rvm_if_this_article>
[article 16]
[Form: exec_list]
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
</txp:rvm_if_this_article>
[article 17]
[Form: exec_list]
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
</txp:rvm_if_this_article>
[article 18]
[Form: exec_list]
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
</txp:rvm_if_this_article>
[article 19]
[Form: exec_list]
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
</txp:rvm_if_this_article>
[article 20]
[Form: exec_list]
<txp:rvm_if_this_article>
[<txp:rvm_if_this_article>: false]
<txp:permlink />
<txp:title />
</txp:rvm_if_this_article>
<txp:article form="bio" status="sticky" limit="1" sort="custom_1 asc" />
[SQL (0.0004730224609375): select Form from txp_form where name='bio']
[Form: bio]
<txp:body />
<txp:output_form form="footer" />
[SQL (0.00037503242492676): select Form from txp_form where name='footer']
[Form: footer]
[ ~~~ secondpass ~~~ ]
-->
Offline
#10 2010-05-18 18:54:45
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Executive Bios with list--What a mess I've made!
OK, I suddenly remembered my old topic about pgonly
on individual article pages. It just doesn’t work. D’oh!
We could easily work around this by wrapping the <txp:article />
tag containing the pgonly="1"
in <txp:if_article_list>...</txp:if_article_list>
tags.
BUT. Now that I re-read Stef’s post here, it looks to me that he is saying that pgonly
also won’t work with sticky articles:
If you’re using an article tag (not article_custom) and your articles are not sticky,
pgonly
will simply set up the pagination info and then return nothing.
If that’s the case – and if Stef says so, it must be ;) – the only solution for you is to change your setup and use live articles instead of sticky ones.
Edit: apologies for not remembering this issue sooner… it probably would have saved you a lot of trouble.
Last edited by els (2010-05-18 18:57:21)
Offline
#11 2010-05-18 20:07:27
- ABL
- Member
- Registered: 2010-03-08
- Posts: 17
Re: Executive Bios with list--What a mess I've made!
Well, I couldn’t get it to work by making the articles live rather than sticky. Same problem.
However, I was able to make it work by adding form="empty_list"
to the <txp:article /> tag AND removing the <txp:if_individual_article> tags (I don’t need them). the form, empty_list is exactly what it says: an empty (blank) form.
Thank you for all of your help! What a crazy problem, huh?
For posterity (ha!), the final code looks like:
table width="875" border="0" cellspacing="7" cellpadding="0">
<tr>
<td align="left" valign="middle"><txp:article status="live" limit="999" sort="custom_1 asc" form="empty_list" />
<txp:link_to_prev><<Previous Profile</txp:link_to_prev></td>
<td align="right" valign="middle"> </td>
<td align="right" valign="middle"><txp:link_to_next>Next Profile>></txp:link_to_next></td>
</tr>
<tr>
<!--LIST OF EXECS-->
<td width="200" align="left" valign="top"><div align="left" class="textsmall2">
<txp:article_custom status="4" limit="999" section="execs" form="exec_list" sort="custom_1 asc" /></td>
<!--BIOS-->
<td valign=top>
<txp:article form="bio" status="live" limit="1" sort="custom_1 asc" />
</div></td>
</tr>
</table></td>
</tr>
</table>
Offline
#12 2010-05-18 20:50:55
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Executive Bios with list--What a mess I've made!
As a matter of fact, as you are only using this on individual article pages, you don’t even need the first article tag with pgonly="1"
. Just wrap your next and prev tags in <txp:if_individual_article>
tags. (You need that to prevent an error message on article list pages.)
It doesn’t work anyway, so why keep it. It’s just a superfluous database query.
<txp:if_individual_article><tr><td align="left" valign="middle">
<txp:link_to_prev><<Previous Profile</txp:link_to_prev></td>
<td align="right" valign="middle"> </td>
<td align="right" valign="middle"><txp:link_to_next>Next Profile>></txp:link_to_next>
</td></tr></txp:if_individual_article>
Last edited by els (2010-05-18 20:51:18)
Offline