สอบถาม Template events : วิธีเรียกไฟล์ CSS / JS มาใช้งานในการพัฒนา Extension

HTML Basic
สำหรับนักพัฒนาเว็บไซต์มือใหม่ HTML , CSS และการใช้ Tools ต่างๆ ในการพัฒนาเว็บไซต์

Moderator: mindphp

ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

สอบถาม Template events : วิธีเรียกไฟล์ CSS / JS มาใช้งานในการพัฒนา Extension

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

Template events

Template events allow extensions to insert template code into event locations found throughout the template structure. Template events found inside phpBB’s template files look like:

โค้ด: เลือกทั้งหมด

<!-- EVENT overall_header_head_append -->
To use a template event, simply name your template file exactly the same as the template event you want to use, and place your template event files in an event/ directory inside your style’s template directory.
For example, the above template event could be used to add some CSS style script to the header. The template file would be located at:

acme/demo/styles/prosilver/template/event/overall_header_head_append.html

A special case for including CSS files and JS files exists. These use the <!-- INCLUDECSS --> and <!-- INCLUDEJS --> syntax, respectively.

For example, to add a new custom.css file in prosilver, a template event would need to be created at:

acme/demo/styles/prosilver/template/event/overall_header_head_append.html

It would contain the following line of code:

โค้ด: เลือกทั้งหมด

<!-- INCLUDECSS ../theme/custom.css -->
To include a JS file in all styles, e.g.: acme/demo/styles/all/js/scripts.js

A template event would be created at:

acme/demo/styles/all/template/event/overall_footer_after.html

It would contain the following line of code:

โค้ด: เลือกทั้งหมด

<!-- INCLUDEJS @acme_demo/js/scripts.js -->
จาก http://www.phpbb.com
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: สอบถาม Template events : วิธีเรียกไฟล์ CSS / JS มาใช้งานในการพัฒนา Extension

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

ที่นี่หนูลองทำตามค่ะ เเต่ผลที่ได้คือ Twig_Error_Loader'
18-11-2557 14-40-03.jpg
18-11-2557 14-40-03.jpg (28.81 KiB) Viewed 1213 times

โค้ด: เลือกทั้งหมด

<!-- INCLUDECSS ../theme/menu.css -->
<div id="cssmenu">
    <ul>
       <li><a href='#'>***</a></li>
       <li class='active has-sub'><a href='#'>xx</a>
          <ul>
            <li><a href='#'>***</a></li>
            <li><a href='#'>***/แข่ง</a></li>
            <li><a href='#'>***</a></li>
          </ul>
       </li>
Fatal error: Uncaught exception 'Twig_Error_Loader' with message 'Unable to find template "../theme/menu.css" (looked into: ./styles/prosilver/template)
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: สอบถาม Template events : วิธีเรียกไฟล์ CSS / JS มาใช้งานในการพัฒนา Extension

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

อีก 1 ตัวอย่าง
18-11-2557 15-25-43.jpg
18-11-2557 15-25-43.jpg (42.31 KiB) Viewed 1212 times

โค้ด: เลือกทั้งหมด

{# Use the space below to include external CSS and JS files
# Here are some example usages:
#
# local files relative to this template file (when stored inside phpBB's style directories):
# <!-- INCLUDEJS script.js -->
# <!-- INCLUDECSS ../theme/style.css -->
#
# hosted on external sites:
# <!-- INCLUDEJS http://code.jquery.com/jquery-migrate-1.2.1.min.js -->
# <!-- INCLUDECSS https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css -->
#
# local files stored inside the Pages extension:
# <!-- INCLUDEJS @phpbb_pages/script.js -->
# <!-- INCLUDECSS @phpbb_pages/../theme/style.css -->
#
#}
<!-- INCLUDECSS @phpbb_pages/../theme/pages_controller.css -->
<!-- INCLUDE overall_header.html -->

<div class="content pages-content">

	{PAGE_CONTENT}

</div>

<!-- EVENT pages_after_page_content -->

<!-- INCLUDE overall_footer.html -->
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 68