Recent Topics

1 Feb 23, 2006 15:56    

I know this is probably a basic question and I am sure that my lack of terminology is why I couldn't find it in my search but here goes:

I use the _lastcomments plugin to display comments on my sidebar.

http://www.coldheartedtruth.com/

Recently I have had issues with my webhost in terms of using up too much CPU - they blame it on too many php scripts? Anyways -

Instead of automatically calling the _lastcomments plugin when you first load the page, I would like to make it an option (click to display latest comments on sidebar) to save on CPU. Not sure how much CPU this would save, but it seems like a call to another file and then another call to the database would use up some.

I have seen this on some basic skins - but would like to be careful about how I edit mine. The nobrainer appears to be to create two skins - one with and one without the comments - with comment's option link simply calling the second skin. But my question there becomes doesn't calling a new skin actually reload the whole page and defeats the purpose of saving CPU? Isn't there a way to have it simply load on it's own into the sidebar after the initial load?

This is the code that I use to call the _lastcomments script

<ul>

<li id="meta"> <?php echo T_('Comments'); ?>:
<ul><li><h4>

<?php // -------------------------- COMMENTS INCLUDED HERE -----------------------------
require( dirname(__FILE__).'/_lastcomments2.php' );
// -------------------------------- END OF COMMENTS ---------------------------------- ?>
</h4></a></li>
</ul>
</li>

</ul>

Also... on a completely different subject now that I have an example:

What purposes does the whole
<li id="meta"> <?php echo T_('Comments'); ?>: serve when
<li>Comments:</li> seems to do the same thing?

2 Feb 23, 2006 18:44

Ok, the whole "just load comments when required without reloading whole page" is pretty much an ajax kind of thing. It works great if the user has js enabled (ask EdB), but still needs a "fallback" for proper degredation.

The chances are that even an ajax kind of thing will use a hell of a lot more cpu/sql time than just pulling the comments when the skin is first called.

Assuming you mean the "T_('Comments')", that's there for translation reasons, if you switch your blog to another language then most of the T_() strings will be displayed in your chosen language. Even if a string isn't implemented at the moment it's a good habit to get into using them as it may be added in the future and makes things far easier for people whose first language isn't English...... like american or summat :|

¥


Form is loading...