Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
r3780 small question
The question of best practice programming.
Why two SQL queries with PHP code better than one SQL query?
/textpattern/lib/txplib_misc.php line 2127
$out = safe_field('user_html','txp_page',"name='error_".doSlash($code)."'"); if ($out === false) $out = safe_field('user_html','txp_page',"name='error_default'");
vs
$out = safe_field('user_html','txp_page',"name='error_".doSlash($code)."' or name='error_default' order by name limit 1");
Thanks for the response.
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Offline
Re: r3780 small question
IMHO, $code
– is a numeric or blank.
error_000
, error_999
, error_
always will be first then error_default
or in Textpattern $code
maybe a string?…
Upd: RFC2616 describe numeric codes from 100 to 505.
Last edited by makss (2012-05-10 13:01:22)
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Offline
Re: r3780 small question
Gocom wrote:
Status is just the name of the prefixed page template. As currently there are no actual set limitations what that name should be, the status can be anything.
What about RFC2616 ?
Status used in txp_status_header($status);
like header("HTTP/1.1 $status");
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Offline
Re: r3780 small question
Let me explain my reasoning why I chose one patch over the other:
I consider the patch I merged into r3780 as a more robust and – imho even more important – a more legible solution. Exploiting side effects (like sort order) for program logic might be useful for time critical code paths where we want to squeeze out every single cpu cycle but in this case I’d rather have an obvious code path than a clever hack.
Offline
Re: r3780 small question
Jukka, Robert, Thanks for the responses.
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Pages: 1