(This is an extension on the previous post).
One of the major drawbacks of Blogsome is the handling of Pages is not complete. You can create and manage Pages, but the display of them is sub-standard: there is no page.html template file as there is for Posts (post.html).
However, I have figured out a stop-gap method of running pages through a template.
I tried first to do this by adding a Custom Field, as noted in the WordPress Codex, called _wp_page_template, and setting this value to post.html. This did not work, mainly (as far as I could tell) because the value did not ’stick’. This seems to be a known issue with WordPress 1.5.1. I was able to get enclosure Custom Fields to work (almost: they only ever appeared to be an Array).
The next way I figured out how to do it was by finding a variable that has a different value when a Page is being rendered, as opposed to a Post or Index, or Category, or Archive.
The variable I discovered is {$smarty.server.SCRIPT_NAME}. This appears as '/wp-inst/pages' or '/wp-inst/index.php' under Blogsome. Fantastic!
My next step was to have the following code where {$content} used to be in the Main Page Template:
{if $smarty.server.SCRIPT_NAME == '/wp-inst/pages'}
{assign var=page value=true}
{capture name=the_content}{$content} {/capture}
{include file='post.html'}
{else}
{assign var=page value=false}
{$content}
{/if}
The first line, the {if} clause, finds out if it is indeed a page.
The second line assigns ‘true’ to the variable {$page}, just as a way of making it less cumbersome to test again later.
The third line stores the text that would normally appear in the body of the Page into the variable {$smarty.capture.the_content}. This will be used in place of {$the_content} in the post.html template.
The fourth line puts the contents of the post.html file into the HTML stream.
Just to be safe, I set the value of {$page} to false before the post.html file gets called normally by the {$content} tag.
Then, in the post.html template file, I added the following code:
- Where the content needs to go:
{if $page == 'true'}{$smarty.capture.the_content}{$content}{/if}{the_content}There is no
{else}required here, as{the_content}has no value. - Where the Post Title normally is, I made it:
<a href="{if $page == 'true'}{$Smarty.server.PHP_SELF}{else}{permalink_link}{/if}" rel="bookmark" title="Permanent Link: {if $page == 'true'}{single_post_title}{/if}{the_title_rss}">{if $page == 'true'}{single_post_title}{/if}{the_title}</a>Basically, this replaces
{permalink_link}by the URL of the current Page. I’ll have a bit of a think about how multi-page documents work if I can get them working. It replaces the{the_title}value by{single_post_title}, which works quite nicely. - I also made it so that the Date information is replaced by a Non-Breaking Space - in my template this means that a nice coloured box appears where the Date normally goes: this box is too small otherwise.
{if $page == 'true'} {/if}The date data will be empty, so this should work okay.
- Finally, I used
{if $page != 'true'} ... {/if}to remove information that was not pertinant to a Page, such as the Post time, number of comments, category and so on. I also needed to have the{edit_post_link}skipped in this manner.
I have not yet made comments work properly: I’m not sure that this can be done with this hack, but they will not appear if you just do the things I’ve shown above. If you {include file=comments.html}, you will get the Comment Closed Notification.
Hello from Brussels,
I have a little problem when browsing your blog. The problem appears when clicking on the link “older items” at the bottom of the page.
I got this : “no posts made” on the new page and this as url “http://schinckel.blogsome.com/2005/07/page/2/”
Hope this can help you to solve the problem.
Bye bye Spoutnik
1 day, 6 hours after the fact.
Apologize Matt,
I forgot to say that it only appears when browsing the monthly archives and not on the main page.
1 day, 6 hours after the fact.
Okay, I seem to recall someone else coming across this issue - I’ll try to fix it when I’m not sick! (Hence the dearth of posts recently!)
3 days, 3 hours after the fact.
Hello Matt, I have found on smarty’s forum that variable names are case sensitive and in your code where the Post Title normally is, you have written: {$Smarty.server.PHP_SELF} in your code and it must be written lower case $smarty.
Hope it can help you.
Bye bye
3 days, 18 hours after the fact.
I’m not so sure that this is the case: I’ve interchanged the two and it seems to make no difference.
And the issue with monthly archive next page links not working is an old WP-MU one, that has existed for some time. Doesn’t seem to be going away any time soon. Daily, yearly, category and front pages all work fine, but not monthly.
6 days, 1 hour after the fact.
Hey… got some problems on doing this.
You say that I’va to do this in
page.html… but when I place that file in the “File Searcher”, it appears that doesn’t exist.What’s going on?
4 weeks, 1 day after the fact.
Sorry, should have read
post.html, my error.Been fixed now.
1 month after the fact.
it don’t works to me :-((
i don’t know PHP, this is may post.html:
{if $page == ‘true’}{$smarty.capture.the_content}{/if}{the_content}
{the_category seperator=”, “}{the_date} {the_time}
{if $page == ‘true’}{single_post_title}{/if}{the_title}
{if $page == ‘true’} {/if}
{the_title}
{the_content}
{link_pages before=’Pages: ‘ after=” next_or_number=’number’}
{comments_popup_link zero=’Comments (0)’ one=’Comments (1)’ more=’Comments (%)’}
{include file=comments.html}
the page is: http://tipmachine.blogsome.com
a very bedlam
where i do mistake?
thanx (i need this stop-gap)
1 month, 1 week after the fact.
You have
{the_content}twice. Also, remove the line{include file=comments.html}.Actually, you haven’t actually followed my instructions. If you send me an email with the contents of your post.html template, I’ll try to fix and send it back.
1 month, 1 week after the fact.
okay, i’ll in this way
thanx
angelo
actually, i haven’t understood your instructions!
1 month, 1 week after the fact.
I’m having a hard time getting the pages to work. I think I’ve followed your instructions to a tee… but well… hmmm… can you take a look?
the page in question is http://nardac.blogsome.com/nardac/
6 months, 1 week after the fact.
Actually, you can’t use the name of your blog as a page name - for some reason this won’t work - I’m not sure if this is a bug with my method, or an artifact of Blogsome’s HTTP Rewrite Rules.
Try the setup with another page, and let me know how it works.
6 months, 1 week after the fact.
hello,
I’m quite puzzled by your explanation. I’ve tried to replace the parts you’re indicated, but it didn’t worked out.
My post.html file looks like this less the footer part (don’t fall under your chair, there is some French throught it :- ) :
{the_category seperator=”, “}par {the_author echo=false} le {the_time d=’d.m.Y’} @ {the_time}
{the_title}
{the_content}
This is where I should made the code arrangements? Uhh, do you think you can help me on this? Tx
6 months, 3 weeks after the fact.
Oops, it seems that some code is missing of what I copy/paste… argggh
6 months, 3 weeks after the fact.
Hey, no probs. I did un petit peu of French at Uni, and work in a school that teaches this language, along with six others.
Your code in my comments is being interpreted by the browser. Don’t stress, as I can see your template quite easily.
It seems that you have not put the code into the main page (index.html) template:
{if $smarty.server.SCRIPT_NAME == '/wp-inst/pages'}{assign var=page value=true}
{include file='post.html'}
{else}
{assign var=page value=false}
{$content}
{/if}
Which you need to do first, and then modify your post.html template after that.
The bare minimum is to put:
{if $page == 'true'}{$content}{/if}{the_content}into the page template, the rest is just to make it look nicer, since otherwise it will try to get data about the Page, which doesn’t exist.
If you have a look at my template page (non-IE at this stage, I think, try FireFox), then you can see what my actual code looks like.
6 months, 3 weeks after the fact.
Thanks for your answer Matthew. I put the code into the main page (index.html) template as you indicated. I just checked it for the third time and also took a look at your code in your template.
I also put the code in the post.html as you indicated.
What I obtain is this :
Warning: Smarty error: unable to read resource: “‘post.html’” in /var/www/blogsome/wp-inst/Smarty.class.php on line 1088
I copy your post.html code and I obtain the same answer.
I tried another thing : I already had two pages created a few months ago, so I created a new one just to see if. But I still obtain the message this time with the next/previous page stuff. Any hint?
6 months, 3 weeks after the fact.
I’ve try bozz..
OK now
Thanks
9 months, 3 weeks after the fact.
Thank you bozz
9 months, 3 weeks after the fact.
hello matt,
thanks for the tip, i’ve try it, and it’s work like a charm.
1 year after the fact.
I have a question, what would be the effect(s) on the blog (blogsome) if I remove the entire comments code from the the template;
i mean - http://bse.blogsome.com/wp-admin/templates.php?file=comments.html
2 years, 6 months after the fact.
Possibly, it will just remove the comments from each post.
Try it, and see…
2 years, 6 months after the fact.