This Question is Resolved.

If you have a similiar issue that this thread does not address, click the button below to open a new related support topic.

 
 
Strange error…
Posted: 27 November 2008 08:16 AM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  72
Joined  03-21-2007

Bit of a complicated one this…

First of all, you can see the error here:
http://www.sja.co.uk/site/archive/post/10_intel_atom_netbook/

This is a custom styled “archive” page, because I wanted to be quite particular about the URI format, so I opted not to use the standard archive/permalink options.

The /site/archive template is split up with an {if} statement as follows:

{if "{segment_3}" == "category"}

*SNIP*

{if:elseif "{segment_3}" == "post"}

*SNIP*

{if:elseif "{segment_3}" == "date"}

*SNIP*

{if:else}

*SNIP*

{/if}

Now the only bit of code I can find that affects this error in any way is not in the “post” section, even though that’s the only place the error appears, it’s actually in the “date” section and is as follows:

{exp:weblog:entries weblog="posts" year="{segment_4}" month="{segment_5}" disable="member_data|pagination|trackbacks" dynamic="off"}

In particular:

year="{segment_4}" month="{segment_5}"

If I remove those parameters the error goes away.

I’m completely at a loss here, because as you can see, if you go to the /site/archive/date, the error doesn’t appear:

http://www.sja.co.uk/site/archive/date/2008/11

I’m assuming there’s likely to be some very obvious reason for this and I’ve probably overlooked it, but I’m really scratching my head at the moment - hope you can help!

BTW, I’m running the latest version of EE (1.6.6).

Thanks!
Steve.

 Signature 

Steve Abraham » Web Development & Services » http://www.sja.co.uk/

Profile
 
 
Posted: 27 November 2008 09:07 AM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  16398
Joined  06-03-2002

Hi Steve, few issues here:

1) We won’t be able to see errors unless you have errors set to be visible to all visitors.  Can you just cut and paste the error instead?
2) Your variables in conditionals should not be quoted, please see Troubleshooting Conditionals
3) Without knowing the error, the only way we might help you is if you also share the template code within the conditionals to see how you are breaking things up.

 Signature 
Profile
MSG
 
 
Posted: 27 November 2008 09:16 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  72
Joined  03-21-2007

Hi Derek,

Thanks for getting back to me.

1) Sorry, didn’t know they wouldn’t show to visitors… here are the errors:

Warning: mktime() expects parameter 6 to be long, string given in /home/steve/domains/sja.co.uk/public_html/cms/modules/weblog/mod.weblog.php on line 1842

Warning
: mktime() expects parameter 6 to be long, string given in /home/steve/domains/sja.co.uk/public_html/cms/modules/weblog/mod.weblog.php on line 1843

2) Thanks, I’ve corrected that.

3) Here’s the full template:

{if segment_3 == "category"}

{embed
="site/inc_header"}
<div id="page">
<
p class="header">"{exp:weblog:categories weblog="posts" show="{segment_4}" style="linear" dynamic="off"}{category_name}{/exp:weblog:categories}" Archive</p>
{exp:weblog:entries weblog="posts" category="{segment_4}" disable="member_data|pagination|trackbacks" dynamic="off"}
{if no_results}
<p>Sorry, there are no results to show for this category.</p>
{/if}
<h1><a href="{path='site/archive/post/{url_title}'}">{title}</a></h1>
{summary}
<p class="details">Posted on {entry_date format="%j%S %F %Y"} in {categories backspace="1"}<a href="/site/archive/category/{category_id}">{category_name}</a>, {/categories}.</p>
{/exp:weblog:entries}
</div>
{embed="site/inc_footer"}

{if
:elseif segment_3 == "post"}

{embed
="site/inc_header"}
<div id="page">
<
p class="header">Post Archive</p>
{exp:weblog:entries weblog="posts" limit="1" url_title="{segment_4}" disable="member_data|pagination|trackbacks" dynamic="off"}
{if no_results}
<p>Uh oh, something's gone wrong - can't find the post!</p>
{/if}
<h1>{title}</h1>
{body}
<p class="details">Posted on {entry_date format="%j%S %F %Y"} in {categories backspace="1"}<a href="/site/archive/category/{category_id}">{category_name}</a>, {/categories}.</p>
{/exp:weblog:entries}
</div>
{embed="site/inc_footer"}

{if
:elseif segment_3 == "date"}

{embed
="site/inc_header"}
<div id="page">
<
p class="header">{exp:nice_date date="{segment_4}-{segment_5}-01" format="%F %Y"} Archive</p>
{exp:weblog:entries weblog="posts" year="{segment_4}" month="{segment_5}" disable="member_data|pagination|trackbacks" dynamic="off"}
{if no_results}
<p>Sorry, there are no results to show for this category.</p>
{/if}
<h1><a href="{path='site/archive/post/{url_title}'}">{title}</a></h1>
{summary}
<p class="details">Posted on {entry_date format="%j%S %F %Y"} in {categories backspace="1"}<a href="/site/archive/category/{category_id}">{category_name}</a>, {/categories}.</p>
{/exp:weblog:entries}
</div>
{embed="site/inc_footer"}

{if
:else}

{embed
="site/inc_header"}
<div id="page">
<
p class="header">Archive by date</p>
<
ul>
{exp:weblog:month_links weblog="posts" dynamic="off"}
<li><a href="/site/archive/date/{year}/{month_num}">{month} {year}</a></li>
{/exp:weblog:month_links}
</ul>
<
p class="header">Archive by category</p>
<
ul>
{exp:weblog:categories weblog="posts" style="linear" dynamic="off"}
<li><a href="/site/archive/category/{category_id}">{category_name}</a></li>
{/exp:weblog:categories}
</ul>
</
div>
{embed="site/inc_footer"}

{
/if}

 Signature 

Steve Abraham » Web Development & Services » http://www.sja.co.uk/

Profile
 
 
Posted: 27 November 2008 09:39 AM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  16398
Joined  06-03-2002

Thanks Steve.  The line numbers in those errors indicate that you’re not running the current version; what version and build are you using at present?  It can be found at the bottom of any control panel page.

As a side note, advanced conditionals with multiple statements like you have are parsed towards the end of the process, so all of your tags within them are still being parsed for each page request.  This can consume resources needlessly.  You’ll see what I mean if you turn on the Template Debugger in your Output and Debugging Preferences.  One way to avoid this is to put your tags in another template and put the embeds within your conditionals, that way only the template that has the correct tag for the request gets accessed.

 Signature 
Profile
MSG
 
 
Posted: 27 November 2008 09:42 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Avatar
Rank
Total Posts:  72
Joined  03-21-2007

Hi Derek,

C&P from the bottom of the Control Panel page:

ExpressionEngine 1.6.6 - © Copyright 2003 - 2008 - EllisLab, Inc.
Script executed in 0.0994 seconds   21 SQL queries used
Build:  20081114

Thanks for the info re: conditionals/embeds - you learn something new every day!

Cheers,
Steve.

 Signature 

Steve Abraham » Web Development & Services » http://www.sja.co.uk/

Profile
 
 
Posted: 27 November 2008 12:26 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Avatar
Rank
Total Posts:  72
Joined  03-21-2007

Derek,

I moved the various parts of the conditional into embeds and that seems to have got rid of the error… still no idea what caused it originally though.

Cheers for your help!
Steve.

 Signature 

Steve Abraham » Web Development & Services » http://www.sja.co.uk/

Profile
 
 
Posted: 27 November 2008 12:40 PM   [ Ignore ]   [ # 6 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  16398
Joined  06-03-2002

That’s the better choice, Steve; for an explanation, you could demonstrate the same issue by using the tag:

{exp:weblog:entries weblog="default_site" year="foo"}

Any non-numeric value given to that parameter will trigger that.  I’m going to shift this to the bug forums - obviously the parameter will not work, but using it improperly should not result in a PHP error.

 Signature 
Profile
MSG
 
 
Posted: 27 November 2008 12:45 PM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  72
Joined  03-21-2007

Just to clarify, Derek…

Am I right in formatting it as: year=”{segment_4}” month=”{segment_5}”, or should it be formatted in some other way?

Thanks,
Steve.

 Signature 

Steve Abraham » Web Development & Services » http://www.sja.co.uk/

Profile
 
 
Posted: 27 November 2008 12:59 PM   [ Ignore ]   [ # 8 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  16398
Joined  06-03-2002

That’s fine, it will just cause that error if those segments contain non-numerical input.

 Signature 
Profile
MSG
 
 
Posted: 27 November 2008 01:00 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Avatar
Rank
Total Posts:  72
Joined  03-21-2007

Ah, the penny has just dropped - thanks Derek, I’m with you now.

 Signature 

Steve Abraham » Web Development & Services » http://www.sja.co.uk/

Profile
 
 
Posted: 30 November 2008 11:44 AM   [ Ignore ]   [ # 10 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2550
Joined  05-07-2007

Steve,

I wanted to double check to make sure that everything is up and working for you now.

-greg

 Signature 
Profile
MSG
 
 
Posted: 30 November 2008 04:02 PM   [ Ignore ]   [ # 11 ]  
Grad Student
Avatar
Rank
Total Posts:  72
Joined  03-21-2007

Thanks Greg, yes, it’s spot on since moving to the embedded templates - and better than that, thanks to Derek I understand where I was going wrong!

Cheers!
Steve.

 Signature 

Steve Abraham » Web Development & Services » http://www.sja.co.uk/

Profile
 
 
Posted: 01 December 2008 09:27 AM   [ Ignore ]   [ # 12 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2550
Joined  05-07-2007

cool, I’m glad Derek got you taken care of.  Closing this thread out, but don’t hesitate to post again should anything else come up!

-greg

 Signature 
Profile
MSG
 
 
 

This Question is Resolved.

If you have a similiar issue that this thread does not address, click the button below to open a new related support topic.

 
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66389 Total Logged-in Users: 47
Total Topics: 84714 Total Anonymous Users: 18
Total Replies: 454688 Total Guests: 187
Total Posts: 539402    
Members ( View Memberlist )