PageRenderTime 48ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/includes/build_recursive_content.php

https://bitbucket.org/mpercy/deeemm-cms
PHP | 50 lines | 26 code | 16 blank | 8 comment | 4 complexity | 2c1b48b2fe822895205f509debeb2132 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause
  1. <?php
  2. defined( '_INDM' ) or die( 'POSSIBLE HACK ATTEMPT!' );
  3. /*===========================================================================
  4. Create recursive pages
  5. ===========================================================================*/
  6. $main = read_file($default_url . $templates_dir . "normal_content.tpl");
  7. if (!isset($id) || $id == ''){
  8. //display parent page
  9. //replace admin link template marker if admin
  10. $admin_href = $empty_normal_page_admin_href;
  11. $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . 'cat_' . $page . "` ORDER BY `date` DESC LIMIT 1");
  12. while($sql_result = @mysql_fetch_array($sql_query)){
  13. $id = $sql_result[id];
  14. }
  15. } if(!$action) {
  16. //replace admin link template marker if admin
  17. $admin_href = $normal_page_admin_href;
  18. $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . 'cat_' . $page . "` WHERE `id` = '$id'");
  19. //get data from database
  20. while($sql_result = mysql_fetch_array($sql_query)){
  21. $category = $sql_result[category];
  22. $title = $sql_result[title_lan_ . $language];
  23. $tool_tip = $sql_result[tool_tip_lan_ . $language];
  24. $article_text = $sql_result[description_lan_ . $language];
  25. }
  26. //replace template markers with data from database
  27. $main = str_replace('[var]list_item_href[/var]', $list_item_href, $main);
  28. $main = str_replace('[var]title[/var]', $title, $main);
  29. $main = str_replace('[var]list_body[/var]', $article_text, $main);
  30. $cookie_trial .= $cookie_trial_seperator . $title;
  31. $page_title .= $cookie_trial_seperator . $title;
  32. $list_item_href = "<STRONG><A HREF='$default_url"."index.php?page=$page&amp;id=$sql_result[id]'>";
  33. }
  34. ?>