Problems, need help? Have a tip or advice? Post it here.
17 posts Page 1 of 2
Hi All,

I can't seem to order by publish date on diary page - basically a list of upcoming events. It seems to only show the most recent at the top - changin to and from asc and desc doesn't affect the order:

Code: Select all
               
<cms:pages masterpage='diary.php' folder=k_folder_name start_on=k_achive_date stop_before=k_next_archive_date paginate='1' limit='25'  start_on="<cms:date format='Y-m-d H:i:s' />" show_future_entries='1' orderby='publish_date' sort='asc'>
Hey Patrick, you are using the wrong parameter for setting the sort order.
The actual parameter is 'order' and not 'sort' :)
And, BTW, why are using the 'start_on' parameter twice?
@KK - my bad, sorry about that, had been staring at that code for a long time (sort is the EE permameter - I'm transitioning, EE is so engrained but I'm picking up the Couch tags quickly and referring less and less to them in the docs, i.e. coding a lot form finger muscle memory).

Working fine now!

Why the double start_on - I started this template out as a calendar but didn't want calendar view so I dumped the docs code for it and used a basic "news" list as a starter - I removed them now and it works fine but what I am wondering is can I use archive links for "upcoming" events in the diary - how would one go about that whilst still starting on the current date so I don't show past entries - i.e. how to combine archive ability start on with
Code: Select all
start_on="<cms:date format='Y-m-d H:i:s' />"
.

Or do I need to go back to using the calendar tags to get month links?
The code that you are using
start_on="<cms:date format='Y-m-d H:i:s' />"

should work just fine (coupled with show_future_entries='1') to show only entries that are in the future.

However, I have a doubt..
When you say 'archive links'. I trust you mean the links generated by cms:archives tag, right?
If so, that tag, by default, will generate 'time periods' spanning through all your pages (past and future). So if someone clicks on an older period (i.e. falling before the current date), your logic will not allow any of that period's pages to be listed (as all would be of the past).

Maybe you should set the cms:archives tag's 'start_on' parameter to the current date (along with the show_future_entries='1' )so that it only lists current and future periods.

Or have I understood the scenario wrong? Please let me know.
I get what your saying - I'm just publishing some more test data then I will try it as you suggested and report back.

once again, thanks for the help, it's truly appreciated! One day, soon, I will be self sufficient, I'm picking up approaches on the way, this is only the second site I'm using Couch for and I'm flying through the development / porting of a site to it. I'd anticipate 5 more sites under the belt before the month is out.
Hi KK,

Ok, so my diary_list uses the following:

Code: Select all
               
<cms:pages masterpage='diary.php' folder=k_folder_name paginate='1' limit='15'  start_on="<cms:date format='Y-m-d H:i:s' />" stop_before=k_next_archive_date show_future_entries='1' orderby='publish_date' order='asc'>


and my diary_sidebar.php is:

Code: Select all
<h4><cms:show k_template_title /> by Category</h4>
<ul class="nav nav-pills nav-stacked">
<cms:folders masterpage='diary.php' orderby='title'>
   <li><a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a></li>
</cms:folders>
</ul>

<h4><cms:show k_template_title /> by Month</h4>
<ul class="nav nav-pills nav-stacked">
<cms:archives masterpage='diary.php' start_on="<cms:date format='Y-m-d H:i:s' />" show_future_entries='1' order='asc'>
   <li><a href="<cms:show k_archive_link />"><cms:date k_archive_date format='F' /></a></li>
</cms:archives>
</ul>


I cant get it working with that, when I click the month of March is displays the single entry fine, if I try "April" it shows all 10 entries for that month + march - I presume this is because my start date is set to the current date.

Is there any way of setting a variable or something to say - "Hey, you've not clicked a monthly archive (in this case future archive) link yet so lets display 25 upcoming entries from todays date" but when and archive link is clicked it detects this (possibly from the URL segment?) and says "wait, that current URL segment, or the month I am been asked to show is beyond todays date so I will treat anything older than the current month as a past entry"?

Maybe I am going about this the complete wrong way - please let me know if so, and sorry again to be bothering you, please don't think I am asking you to do it for me, I sincerely want to master this CMS, I just think I might be coming at things with the past experience of doing them with other CMS's in similar / different ways or relying on Plugins.
You are welcome to ask away any question that crosses your mind Patrick :) I'll be only glad to try and answer them.

The problem you mentioned -
See, you are hard coding the cms:pages tag to always start from the current date and that is what is happening for all archive periods - 'March' starts from 'Feb' (the current month) and so does 'April' (which then includes March also).

The solution is to use the conventional start_on=k_achive_date.
Since now we are making the cms:archives tag provide the right start and end dates, the cms:pages should simply follow those.

Please try this and let me know if it works.
Hi KK - I went in to try this but I've busted something in my attempts becaus enow when I try and visit the page I get:

Code: Select all
 Fatal error: Call to undefined method kfield::_update() in /nfs/c04/h05/mnt/162284/domains/mydomain.com/html/couch/tags.php on line 1105


this is in diary.php, I undid the last 30 mins work in that template and in diary_list.php but still get the error.

Not sure what I have done here..
Can you please look closely at all the editable regions being defined and make sure you are not (mistakenly) using the same name for two of them?
Please let me know.
Hi KK,

I manage to roll back to a previous version of my diary.php and now the issue is resolved.

I tried changing to start on but then I see old / past entries. I will PM you the full template code so you can see what I am trying to achieve, perhaps it's not possible the way I'm trying.
17 posts Page 1 of 2
cron