Author Topic: Question about tags...  (Read 6517 times)

0 Members and 1 Guest are viewing this topic.

Offline ch€ri{Bi}˛

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Question about tags...
« on: March 06, 2006, 09:53:32 PM »
hi,

i saw the answer to my question in the old forum but i don't find it here for the moment...

So, how can i show the entire list of tags?

i mean, i want to display in one page all (existing) tags for a template like this:
{header}
{sitename}
{title}
{thumbnail}
{image}
...
...
{footer}

Thanks for your answers.
ch€ri{Bi}˛


Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Question about tags...
« Reply #1 on: March 06, 2006, 10:59:27 PM »
the list of tags depends on the php site, where the tags were registered.
there are only some few tags e.g. in  sessions.php and page_header which were in every site,
when the mentioned sites are included.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline ch€ri{Bi}˛

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: Question about tags...
« Reply #2 on: March 06, 2006, 11:10:46 PM »
the list of tags depends on the php site, where the tags were registered.
there are only some few tags e.g. in  sessions.php and page_header which were in every site,
when the mentioned sites are included.

yeah! you're right but i remember there was a small (and simple) piece of code which shows all registered tags for a particular page.
i.e: when you launch details.php it shows all registered tags for this page...  :wink:

 :?:?:?:
« Last Edit: March 06, 2006, 11:20:53 PM by cheribibi »
ch€ri{Bi}˛


Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Question about tags...
« Reply #3 on: March 06, 2006, 11:28:55 PM »
ok, it's easy.

on the site, you wish to display all registered tags insert before
Code: [Select]
include(ROOT_PATH.'includes/page_footer.php');
this
Code: [Select]
foreach($site_template->val_cache as $key => $value) {
    echo "key $key -- value $value <br>";
}

Note:
some of the tags are already registered as parsed templates.
Instead of this
Code: [Select]
echo "key $key -- value $value <br>";you can also use
Code: [Select]
echo "key $key  <br>";then only the registered var names will be shown.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline ch€ri{Bi}˛

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: Question about tags...
« Reply #4 on: March 07, 2006, 10:53:48 AM »
OH YES ! it works like a charm  :wink:

 i ask for this because it's useful  :
1) to users who want to make their own template
2) to understand why a tag works (or not  :arrow: debug) and how it works...
3) to optimize code for developpers...

So, to show all existing tags only when you want to debug (actually while displaying queries  :arrow: you can activate it in includes/constants.php ) , here is the code that i put in includes/page_footer.php to make it works on all pages, just after :
Quote
if (defined("PRINT_QUERIES") && PRINT_QUERIES == 1) {
  echo implode('<br><br>', $site_db->query_array);

add :
Code: [Select]
   $i = 0;
  printf("%s","\n<center><table border='0' width='75%' class='bordertable'><tr><td class='head1'><table border='0' cellspacing='1' cellpadding='3'><tr><td align='center' valign='middle' class='head1'> # </td><td class='head1' align='center' valign='middle'> key </td><td class='head1' align='center' valign='middle'> value </td></tr>");
foreach($site_template->val_cache as $key => $value) {

$row_bg_number = ($i++ % 2 == 0) ? 1 : 2;
    printf("%s","<tr class=\"imagerow".$row_bg_number."\"><td align='center' valign='middle'> ".$i." </td><td align='center' valign='middle'> ");
printf("{%s}", $key);
printf("%s"," </td><td align='center' valign='middle'> ".$value." </td></tr>");
}
printf("%s","</table></td></tr></table></center>\n");

Thank you very much IcEcReaM for your quick help!

Best regards.
ch€ri{Bi}˛


Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Question about tags...
« Reply #5 on: March 07, 2006, 03:24:56 PM »
no problem.

Quote
2) to understand why a tag works (or not  Arrow debug) and how it works...
to check more easily if you have set everything alright it might be better to use "echo" to output the values,
instead of controlling the wholen customized template when it's very large.

Sometimes it's also useful to use an debugger for php like DBG.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump