AmpHtml View Example - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: AmpHtml View Example (/showthread.php?tid=66446) |
AmpHtml View Example - John_Betong - 10-22-2016 AmpHtml No doubt you have all heard the hype about the AmpProject and/or AmpHtml web-pages and wondering if they would be suitable for your web-site? I started using them a couple of months ago and delighted with the results mostly due to Google's Free Cache. Also the increased exposure because Google's search results favours valid AmpHtml web-pages. Please note the emphasis on valid AmpHtml pages. This is by no means a simple task mostly due to W3.org's specifications not being followed. From bitter experience I have found it beneficial to first create a validate web-page on your own web-site. Once created Google WebMaster Tools may be used to check validity or better still install Google Chromes's Extension: [b]AMP Validator 1.0.9[/b] because it saves cutting & pasting the URLs into AmpHtml Validators. AmpHtml Basics 1. Doctype must be HTML 2. <html> requires an AmpHtml Flash or <html amp> 3. A CSS subset is used prohibiting certain features such as inline style, img, iframe, form, JavaScript, etc. 4. ONLY Google JavaScript may be used!!! First: The Bad News As previously mentioned, many of W3.org's existing protocols have been dropped. Existing W3.org HTML validation fails! There are numerous alternative validation methods available. The best I have found is a Google Chrome Extension which dynamically validates in the background and has helpful messages related to the invalid script. Second: The Good News Certain static header information is essential and best if required separately (amp-header.php). An **amp-header.php** template can be included to simplify the web-page creation task. This basic PHP template accepts a few parameters and generates valid header. AmpHtml CodeIgniter View Template: This is my minimal valid web-page which can be created using two files. First is the view page and secondly a PHP include file: **View file:** PHP Code: <?php file: amp-header.php PHP Code: <?php # _amp-header.php Accordion-example.php PHP Code: <div class="w88 mga"> enjoy |