{"id":76,"date":"2006-11-22T14:55:26","date_gmt":"2006-11-22T14:55:26","guid":{"rendered":"http:\/\/www.rumahweb.com\/journal\/web-template-tanpa-table-php-javascript-dan-css-bagian-4.htm"},"modified":"2006-11-22T14:57:29","modified_gmt":"2006-11-22T14:57:29","slug":"web-template-tanpa-table-php-javascript-dan-css-bagian-4","status":"publish","type":"post","link":"https:\/\/www.rumahweb.com\/journal\/web-template-tanpa-table-php-javascript-dan-css-bagian-4\/","title":{"rendered":"Web Template Tanpa Table &#8211; PHP, JavaScript, dan CSS (Bagian 4)"},"content":{"rendered":"<p>Berikut ini adalah engine yang akan digunakan membaca file template, mengisinya dengan modul-modul dan menampilkan ke web browser.<\/p>\n<p><!--more--><\/p>\n<p>engine.php<\/p>\n<p>[php]<br \/>\nclass Template {<br \/>\nvar $html = &#8220;&#8221;;<\/p>\n<p>function Template($fileTemplate) {<br \/>\n$namaFile = &#8220;$fileTemplate&#8221;;<br \/>\n$penunjukFile = fopen($namaFile, &#8220;r&#8221;);<br \/>\n$this-&gt;html = fread($penunjukFile, filesize($namaFile));<br \/>\nfclose($penunjukFile);<br \/>\n}<\/p>\n<p>function isiVar($namaVar, $isiVar) {<br \/>\n$this-&gt;html = ereg_replace(&#8220;#$namaVar#&#8221;, $isiVar, $this-&gt;html);<br \/>\n}<\/p>\n<p>function isiBlokKiri($modulnya = array()) {<br \/>\n$isiBlokTotal = &#8220;&#8221;;<br \/>\nforeach($modulnya as $kunci =&gt; $nilai) {<br \/>\ninclude_once(&#8220;kiri\/$nilai.php&#8221;);<br \/>\n$isiBlokTotal .= $dt;<br \/>\n}<br \/>\n$this-&gt;html = ereg_replace(&#8220;#BLOCK_KIRI#&#8221;, $isiBlokTotal, $this-&gt;html);<br \/>\n}<\/p>\n<p>function isiContent($modulenya) {<br \/>\ninclude_once(&#8220;content\/$modulenya.php&#8221;);<br \/>\n$this-&gt;html = ereg_replace(&#8220;#CONTENT#&#8221;, $dt, $this-&gt;html);<br \/>\n}<\/p>\n<p>function isiBlokKanan($modulnya = array()) {<br \/>\n$isiBlokTotal = &#8220;&#8221;;<br \/>\nforeach($modulnya as $kunci =&gt; $nilai) {<br \/>\ninclude_once(&#8220;kanan\/$nilai.php&#8221;);<br \/>\n$isiBlokTotal .= $dt;<br \/>\n}<br \/>\n$this-&gt;html = ereg_replace(&#8220;#BLOCK_KANAN#&#8221;, $isiBlokTotal, $this-&gt;html);<br \/>\n}<\/p>\n<p>function tampilkanContent() {<br \/>\necho $this-&gt;html;<br \/>\n}<br \/>\n}<br \/>\n[\/php]<\/p>\n<p>index.php<\/p>\n<p>[php]<br \/>\nerror_reporting(&#8220;E_ERROR&#8221;);<\/p>\n<p>include_once(&#8220;engine.php&#8221;);<\/p>\n<p>$tpl = new Template(&#8216;utama.htm&#8217;);<\/p>\n<p>$content = $_REQUEST[&#8216;content&#8217;];<br \/>\nif (empty($content)) {<br \/>\n$content = &#8216;home&#8217;;<br \/>\n}<\/p>\n<p>$kiri = array(&#8216;menu-vertikal&#8217;, &#8216;kotak-weblogin&#8217;);<br \/>\n$kanan = array(&#8216;polling&#8217;, &#8216;shoutbox&#8217;);<\/p>\n<p>$tpl-&gt;isiVar(&#8216;JUDUL_WEBSITE&#8217;, &#8216;Website Buat Belajar Aja&#8217;);<\/p>\n<p>$tpl-&gt;isiBlokKiri($kiri);<br \/>\n$tpl-&gt;isiContent($content);<br \/>\n$tpl-&gt;isiBlokKanan($kanan);<\/p>\n<p>$tpl-&gt;tampilkanContent();<br \/>\n[\/php]<\/p>\n<p>Silakan di cek lagi susunan file dan direktori adalah sebagai berikut:<\/p>\n<p>index.php<br \/>\nutama.htm<br \/>\ntable.css<br \/>\nengine.php<br \/>\nkiri\/menu-vertikal.php<br \/>\nkiri\/kotak-weblogin.php<br \/>\ncontent\/home.php<br \/>\ncontent\/berita-terbaru.php<br \/>\nkanan\/polling.php<br \/>\nkanan\/shoutbox.php<\/p>\n<p>Selamat mencoba!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Berikut ini adalah engine yang akan digunakan membaca file template, mengisinya dengan modul-modul dan menampilkan ke web browser.<\/p>\n","protected":false},"author":57,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-76","post","type-post","status-publish","format-standard","category-news"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Berikut ini adalah engine yang akan digunakan membaca file template, mengisinya dengan modul-modul dan menampilkan ke web browser. engine.php [php] class Template { var $html = &quot;&quot;; function Template($fileTemplate) { $namaFile = &quot;$fileTemplate&quot;; $penunjukFile = fopen($namaFile, &quot;r&quot;); $this-&gt;html = fread($penunjukFile, filesize($namaFile)); fclose($penunjukFile); } function isiVar($namaVar, $isiVar) { $this-&gt;html = ereg_replace(&quot;#$namaVar#&quot;, $isiVar, $this-&gt;html); } function isiBlokKiri($modulnya\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"dwisp\"\/>\n\t<meta name=\"google-site-verification\" content=\"wPstUwU5246IbK_1PqwGrc1LoSDnB-9rPbcT8_vSNgQ\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.rumahweb.com\/journal\/web-template-tanpa-table-php-javascript-dan-css-bagian-4\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"id_Id\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Rumahweb Journal \u2013 News, Article, and Tutorial of Web Dev\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Web Template Tanpa Table \u2013 PHP, JavaScript, dan CSS (Bagian 4)\" \/>\n\t\t<meta property=\"og:description\" content=\"Berikut ini adalah engine yang akan digunakan membaca file template, mengisinya dengan modul-modul dan menampilkan ke web browser. engine.php [php] class Template { var $html = &quot;&quot;; function Template($fileTemplate) { $namaFile = &quot;$fileTemplate&quot;; $penunjukFile = fopen($namaFile, &quot;r&quot;); $this-&gt;html = fread($penunjukFile, filesize($namaFile)); fclose($penunjukFile); } function isiVar($namaVar, $isiVar) { $this-&gt;html = ereg_replace(&quot;#$namaVar#&quot;, $isiVar, $this-&gt;html); } function isiBlokKiri($modulnya\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.rumahweb.com\/journal\/web-template-tanpa-table-php-javascript-dan-css-bagian-4\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2006-11-22T14:55:26+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2006-11-22T14:57:29+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RumahwebIndonesia\/\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@rumahwebtweet\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Web Template Tanpa Table \u2013 PHP, JavaScript, dan CSS (Bagian 4)\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Berikut ini adalah engine yang akan digunakan membaca file template, mengisinya dengan modul-modul dan menampilkan ke web browser. engine.php [php] class Template { var $html = &quot;&quot;; function Template($fileTemplate) { $namaFile = &quot;$fileTemplate&quot;; $penunjukFile = fopen($namaFile, &quot;r&quot;); $this-&gt;html = fread($penunjukFile, filesize($namaFile)); fclose($penunjukFile); } function isiVar($namaVar, $isiVar) { $this-&gt;html = ereg_replace(&quot;#$namaVar#&quot;, $isiVar, $this-&gt;html); } function isiBlokKiri($modulnya\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@rumahwebtweet\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Web Template Tanpa Table \u2013 PHP, JavaScript, dan CSS (Bagian 4)","description":"Berikut ini adalah engine yang akan digunakan membaca file template, mengisinya dengan modul-modul dan menampilkan ke web browser. engine.php [php] class Template { var $html = \"\"; function Template($fileTemplate) { $namaFile = \"$fileTemplate\"; $penunjukFile = fopen($namaFile, \"r\"); $this->html = fread($penunjukFile, filesize($namaFile)); fclose($penunjukFile); } function isiVar($namaVar, $isiVar) { $this->html = ereg_replace(\"#$namaVar#\", $isiVar, $this->html); } function isiBlokKiri($modulnya","canonical_url":"https:\/\/www.rumahweb.com\/journal\/web-template-tanpa-table-php-javascript-dan-css-bagian-4\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"wPstUwU5246IbK_1PqwGrc1LoSDnB-9rPbcT8_vSNgQ","miscellaneous":""},"schema":null,"og:locale":"id_Id","og:site_name":"Rumahweb Journal \u2013 News, Article, and Tutorial of Web Dev","og:type":"article","og:title":"Web Template Tanpa Table \u2013 PHP, JavaScript, dan CSS (Bagian 4)","og:description":"Berikut ini adalah engine yang akan digunakan membaca file template, mengisinya dengan modul-modul dan menampilkan ke web browser. engine.php [php] class Template { var $html = &quot;&quot;; function Template($fileTemplate) { $namaFile = &quot;$fileTemplate&quot;; $penunjukFile = fopen($namaFile, &quot;r&quot;); $this-&gt;html = fread($penunjukFile, filesize($namaFile)); fclose($penunjukFile); } function isiVar($namaVar, $isiVar) { $this-&gt;html = ereg_replace(&quot;#$namaVar#&quot;, $isiVar, $this-&gt;html); } function isiBlokKiri($modulnya","og:url":"https:\/\/www.rumahweb.com\/journal\/web-template-tanpa-table-php-javascript-dan-css-bagian-4\/","article:published_time":"2006-11-22T14:55:26+00:00","article:modified_time":"2006-11-22T14:57:29+00:00","article:publisher":"https:\/\/www.facebook.com\/RumahwebIndonesia\/","twitter:card":"summary_large_image","twitter:site":"@rumahwebtweet","twitter:title":"Web Template Tanpa Table \u2013 PHP, JavaScript, dan CSS (Bagian 4)","twitter:description":"Berikut ini adalah engine yang akan digunakan membaca file template, mengisinya dengan modul-modul dan menampilkan ke web browser. engine.php [php] class Template { var $html = &quot;&quot;; function Template($fileTemplate) { $namaFile = &quot;$fileTemplate&quot;; $penunjukFile = fopen($namaFile, &quot;r&quot;); $this-&gt;html = fread($penunjukFile, filesize($namaFile)); fclose($penunjukFile); } function isiVar($namaVar, $isiVar) { $this-&gt;html = ereg_replace(&quot;#$namaVar#&quot;, $isiVar, $this-&gt;html); } function isiBlokKiri($modulnya","twitter:creator":"@rumahwebtweet"},"aioseo_meta_data":{"post_id":"76","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"","defaultPostTypeGraph":""},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-21 10:48:06","updated":"2026-04-19 02:47:39","seo_analyzer_scan_date":null},"_links":{"self":[{"href":"https:\/\/www.rumahweb.com\/journal\/wp-json\/wp\/v2\/posts\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rumahweb.com\/journal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rumahweb.com\/journal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rumahweb.com\/journal\/wp-json\/wp\/v2\/users\/57"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rumahweb.com\/journal\/wp-json\/wp\/v2\/comments?post=76"}],"version-history":[{"count":0,"href":"https:\/\/www.rumahweb.com\/journal\/wp-json\/wp\/v2\/posts\/76\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rumahweb.com\/journal\/wp-json\/wp\/v2\/media?parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rumahweb.com\/journal\/wp-json\/wp\/v2\/categories?post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rumahweb.com\/journal\/wp-json\/wp\/v2\/tags?post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}