Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Tagi w PHP
Forum PHP.pl > Forum > Przedszkole
Darkon
Witam zakupiłem skrypt w którym style opierają się na tagach i mam problem ponieważ chciałem zrobić dynamiczne meta i tak np w blogs_full.php działa tag subject oznacza nazwę notki a np w includowanym pliku _header_blogi.html tah {subject} już nie działa . można zobaczyć to tutaj http://xol-live.pl/blogs_full.php?id=17

tu podaję 3 pliki odpowiedzialne za to

blogs_full.php
  1. <?php
  2. /* (C) ABK-Soft Ltd., 2004-2006
  3. IMPORTANT: This is a commercial software product
  4. and any kind of using it must agree to the ABK-Soft
  5. Ltd. license agreement.
  6. It can be found at <a href=\"http://abk-soft.com/license.doc\" target=\"_blank\">http://abk-soft.com/license.doc</a>
  7. This notice may not be removed from the source code. */
  8.  
  9. include("./_include/core/main_start.php");
  10. payment_check('blogs_read');
  11. if (isset($g['options']['blogs']) and $g['options']['blogs'] == "N") redirect('home.php');
  12.  
  13. class CBlog extends CHtmlBlock
  14. {
  15. function action()
  16. {
  17. global $g;
  18. global $g_user;
  19. $cmd = get_param("cmd", "");
  20.  
  21. if ($cmd == "comment")
  22. {
  23. if ($g_user['user_id'] == 0) redirect("join.php");
  24. if (trim(get_param("comment", "")) != "")
  25. {
  26. DB::execute("
  27. INSERT INTO blog_comment SET
  28. msg_id=" . to_sql(get_param("id", ""), "Number") . ",
  29. user_id=" . $g_user['user_id'] . ",
  30. comment=" . to_sql(get_param("comment", ""), "Text") . ",
  31. dt='" . date('Y-m-d H:i:s') . "';
  32. ");
  33. DB::execute("
  34. UPDATE blog_msg SET count_comment=(count_comment+1)
  35. WHERE id=" . to_sql(get_param("id", ""), "Number") . "
  36. ");
  37. }
  38. }
  39. }
  40. function parseBlock(&$html)
  41. {
  42. global $g;
  43. global $g_user;
  44.  
  45. if ($g['options']['blogs'] == "Y")
  46. {
  47. $html->parse("my_blog", true);
  48. }
  49. else
  50. {
  51. redirect("home.php");
  52. }
  53.  
  54. DB::query("
  55. SELECT u.*, b.*, YEAR(FROM_DAYS(TO_DAYS('" . date('Y-m-d H:i:s') . "')-TO_DAYS(birth))) AS age
  56. FROM (blog_msg AS b LEFT JOIN user AS u ON u.user_id=b.user_id)
  57. WHERE b.id=" . to_sql(get_param("id", ""), "Number") . "
  58. ");
  59.  
  60. if ($row = DB::fetch_row())
  61. {
  62. DB::query("
  63. SELECT u.*, b.*, YEAR(FROM_DAYS(TO_DAYS('" . date('Y-m-d H:i:s') . "')-TO_DAYS(birth))) AS age
  64. FROM (blog_comment AS b LEFT JOIN user AS u ON u.user_id=b.user_id)
  65. WHERE b.msg_id=" . to_sql(get_param("id", ""), "Number") . "
  66. ");
  67. while ($row2 = DB::fetch_row())
  68. {
  69. foreach ($row2 as $k => $v)
  70. {
  71. $html->setvar($k, to_html($v));
  72. }
  73. $html->setvar("comment", to_html($row2['comment']));
  74. $html->parse("comment", true);
  75. }
  76.  
  77. foreach ($row as $k => $v)
  78. {
  79. $html->setvar($k, to_html($v));
  80. }
  81. $html->setvar("msg", to_html($row['msg']));
  82.  
  83. if ($row['image'] != "")
  84. {
  85. $html->setvar("image", $row['id'] . ".jpg");
  86. $html->parse($this->m_name . "_image", false);
  87. }
  88. else
  89. {
  90. $html->setblockvar($this->m_name . "_image", "");
  91. }
  92.  
  93. #$html->setvar("city_title", DB::result("SELECT city_title FROM geo_city WHERE city_id=" . $row['city_id'], 0, 2));
  94. #$html->setvar("state_title", DB::result("SELECT state_title FROM geo_state WHERE state_id=" . $row['state_id'], 0, 2));
  95. #$html->setvar("country_title", DB::result("SELECT country_title FROM geo_country WHERE country_id=" . $row['country_id'], 0, 2));
  96. }
  97. else
  98. {
  99. redirect("blogs.php");
  100. }
  101.  
  102. parent::parseBlock($html);
  103. }
  104. }
  105.  
  106. $page = new CBlog("blogs_list", $g['tmpl']['dir_tmpl_main'] . "blogs_full.html");
  107. $header = new CHeader("header_blogi", $g['tmpl']['dir_tmpl_main'] . "_header_blogi.html");
  108. $page->add($header);
  109. $footer = new CFooter("footer", $g['tmpl']['dir_tmpl_main'] . "_footer.html");
  110. $page->add($footer);
  111.  
  112. $users_ims = new CIms("ims", $g['tmpl']['dir_tmpl_main'] . "_ims.html");
  113. $page->add($users_ims);
  114.  
  115. include("./_include/core/main_close.php");
  116.  
  117. ?>


blogs_full.html
  1. {header_blogi}
  2. {ims}
  3.  
  4. <div id="wide" class="box"><div class="bbt"><div class="bbb"><div class="bbl"><div class="bbr"><div class="bbtl"><div class="bbtr"><div class="bbbl"><div class="bbbr">
  5.  
  6.  
  7.  
  8.  
  9.  
  10. <div class=header_small style="float:left; margin-top:20px; margin-bottom:5px;">{subject}</div>
  11.  
  12. <div style="float:right; margin-top:25px; margin-bottom:5px;"><a href="{url_main}search_results.php?name={name}"><b>{name}</b></a> | {dt}</div>
  13.  
  14.  
  15.  
  16. <div align="left">
  17.  
  18. <table width="100%" border="0" class="blog_bg" style="clear:both;"><tr>
  19.  
  20. <td width="1" valign="top">
  21.  
  22. <div style="padding: 10px;">
  23.  
  24. <!-- begin_blogs_list_image -->
  25.  
  26. <img src="{url_files}blog/{image}" border="0" class="blog_photo">
  27.  
  28. <!-- end_blogs_list_image -->
  29.  
  30. </div>
  31.  
  32. </td>
  33.  
  34. <td valign="top">
  35.  
  36. <div style="padding: 5px; ">{msg}</div>
  37.  
  38. </td>
  39.  
  40. </tr></table>
  41.  
  42.  
  43.  
  44. </div>
  45.  
  46. <div align="right" class="blog_inf">
  47.  
  48. <a href="{url_main}blogs_view.php?id={user_id}" class="pri_little_bold">{l_view_blog}</a>
  49.  
  50. </div>
  51.  
  52. <br />
  53.  
  54. <br />
  55.  
  56.  
  57.  
  58.  
  59.  
  60. <!-- begin_comment -->
  61.  
  62. <div class=header_small style="float:left; margin-top:20px; margin-bottom:5px;">{subject}</div>
  63.  
  64. <div style="float:right; margin-top:25px; margin-bottom:5px;"><a href="{url_main}search_results.php?name={name}"><b>{name}</b></a> | {dt}</div>
  65.  
  66.  
  67.  
  68. <table width="100%" border="0" class="light" style="clear:both;"><tr>
  69.  
  70. <td width="1" valign="top">
  71.  
  72. <div style="padding: 10px;">
  73.  
  74. <!-- begin_blogs_list_image -->
  75.  
  76. <img src="{url_files}blog/{image}" border="0">
  77.  
  78. <!-- end_blogs_list_image -->
  79.  
  80. </div>
  81.  
  82. </td>
  83.  
  84. <td valign="top">
  85.  
  86. <div style="padding: 5px; ">{comment}</div>
  87.  
  88. </td>
  89.  
  90. </tr></table>
  91.  
  92.  
  93.  
  94. <br />
  95.  
  96. <br />
  97.  
  98. <!-- end_comment -->
  99.  
  100.  
  101.  
  102. <div align="left" >
  103.  
  104. <form action="{url_page}?id={id}" method="POST">
  105.  
  106. <input type="hidden" name="cmd" value="comment">
  107.  
  108. <textarea name="comment" style="width: 760px; height: 100px;" rows="1" cols="20"></textarea>
  109.  
  110. <br><br>
  111.  
  112. <input type="submit" class="button" style=" padding-left: 5px; padding-right: 5px;cursor: pointer; cursor: hand;" tabindex="13" value="{l_send_comment}">
  113.  
  114. </form>
  115.  
  116. </div>
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126. </div></div></div></div></div></div></div></div></div>
  127.  
  128.  
  129.  
  130. {footer}


Ostatniego Pliku _header_blogi.html nie szło wgrać
tomekpl
Ja nie widze błedu na stronie, jest wszystko ok w tytule
Darkon
po napisie czytasz news/wpis: powinien pokazać się tytuł notki a się nie pokazuje
tomekpl
Zrób odczytywanie wartości z bazy po warunku get id

get=1 wyswietl baza_tytul
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.