ez |
|
---|---|
Hi There,
functions.php::sed_build_comments() $res = '<a href="' . $url . '#comments" class="comments_link"><img src="skins/' . $usr['skin']
. '/img/system/icon-comment.gif" alt="" />';
I think this should be in a TPL, not hardcoded... Please remove it from the low level functions... thnx, Leo p.s. What a monster function is this one... If I only want to show a picture and a comment count, this sed_build_comments() is overkill. e.g. In the news plugin (we could use a lighter function for just getting a count. And the function below is Lightweight and also TPL friendly (this is just an idea) function sed_get_comments_count($code)
{
global $db_com, $cfg, $usr;
list($usr['auth_read_com'], $usr['auth_write_com'], $usr['isadmin_com']) = sed_auth('comments', 'a');
sed_block($usr['auth_read_com']);
if ($cfg['disable_comments'] || !$usr['auth_read_com']) return ("");
$ret="";
if ($cfg['countcomments'])
{
if (isset($totalitems)) $nbcomment = $totalitems;
else $nbcomment = sed_sql_result(sed_sql_query("SELECT COUNT(*) FROM $db_com where com_code='$code'"), 0, 0);
$ret = (string)$nbcomment;
}
return($ret);
} Added 1 hour 4 minutes later: I have made this for the NEWS plugin on a test site, and it works like a charm.. also this is more MVC, because I can do everything in the TPL's. And I think the speed is better (must test this somewhat further) Hope you all think about implementing this.... ![]() ==- I say: Keep it EZ -==
|
|
Отредактировано: ez (12.02.2010 18:27, 15 лет назад) |
Trustmaster |
|
---|---|
Icons are moved to customizable resource files in Siena.
Yes, current coments/ratings is rubbish. In Siena we are going to make them plugins, with TPL files. May the Source be with you!
|
ez |
|
---|---|
Can I make a suggestion for the resources.... Use CSS Sprites for icon thingies !
I am working on that right now.. (That's how i came to the hardcoded comments link ![]() It reduces the number off request to the server !! (And thats a good thing) ==- I say: Keep it EZ -==
|
Trustmaster |
|
---|---|
Sprites are quite hard to maintain, especially for non-designers.
May the Source be with you!
|
ez |
|
---|---|
I have been playing with sprites for a few days now, there are a few good articles about it.
BUT, you are right, you have to know how those Sprites work. Still it improves performance. Here are some documents (for the interested) Articles: http://www.alistapart.com/articles/sprites/ http://www.websiteoptimization.com/speed/tweak/css-sprites/ General website optimizing: http://developer.yahoo.com/performance/rules.html ==- I say: Keep it EZ -==
|
smithjon |
|
---|---|
I only want to show a picture and a comment count, this sed_build_comments() is overkill. asad
|
pieter |
|
---|---|
What do you want to do? ... can we help you ...
|