It generates Google AMP sites using PHP
The library generates Google AMP sites using PHP by using procedural code.
This application simplifies (via code) the generation of an AMP site. It’s easiest to program, just a few of lines of code and that’s it.
For example, let’s say that you want to add a new section
$secImage= new SectionModel("The Cupcakes","","/image.jpg");
$secImage->buttons[]=new ButtonModel("More Information","#");
$secImage->buttons[]=new ButtonModel("More Information","#","warning");
$amp->sectionImage($secImage,2250,441);
It will generate the next visual:
use eftec\AmpGeneratorOne\AmpGeneratorOne;
use eftec\AmpGeneratorOne\ButtonModel;
use eftec\AmpGeneratorOne\FooterModel;
use eftec\AmpGeneratorOne\HeaderModel;
use eftec\AmpGeneratorOne\HeadModel;
use eftec\AmpGeneratorOne\LinkModel;
use eftec\AmpGeneratorOne\SectionModel;
include "lib/AmpGeneratorOne.php";
$amp=new AmpGeneratorOne("https://www.canonical.com","https://www.canonical.com/amp");
// #
$amp->startAmp(new HeaderModel("description","title","favicon.ico"));
// # sidebar (optional)
$amp->sidebar($menu); // $menu is an array of /LinkModel()
// #1 head (the top bar)
$amp->head(new HeadModel("",$base."logo.png"),70,70);
// # example section
$amp->sectionFirst(new SectionModel("Title","Description"));
// # footer
$amp->sectionFooter(new FooterModel("Copyright something(c)","See as desktop"));
amp->render(); // you also could generate a file.
Tablet version
Mobile version
.jpg)
Mobile version (slider open)
AmpGeneratorOne constructor.
$tmp=$ampgeneratorone->fixRelativeUrlthis();
$tmp=$ampgeneratorone->genStructuredthis();
$tmp=$ampgeneratorone->sidebarthis();
$tmp=$ampgeneratorone->headthis();
$tmp=$ampgeneratorone->sectionFooterthis();
HeaderModel());
$tmp=$ampgeneratorone->sectionAnalyticsthis();
$tmp=$ampgeneratorone->sectionFirstthis();
$tmp=$ampgeneratorone->sectionImageButtonthis();
$tmp=$ampgeneratorone->sectionTextthis();
$tmp=$ampgeneratorone->sectionTextQuotethis();
$tmp=$ampgeneratorone->sectionULthis();
$tmp=$ampgeneratorone->sectionOLthis();
$tmp=$ampgeneratorone->sectionButtonsthis();
$tmp=$ampgeneratorone->sectionColsthis();
$tmp=$ampgeneratorone->sectionHeaderCentralthis();
It generates a section with an image content.
$tmp=$ampgeneratorone->sectionImageContentthis();
$tmp=$ampgeneratorone->sectionImageContentLeftthis();
$tmp=$ampgeneratorone->sectionTablethis();
$tmp=$ampgeneratorone->sectionImagethis();
$tmp=$ampgeneratorone->sectionGMapFullthis();
$tmp=$ampgeneratorone->sectionGMapBoxedthis();
$tmp=$ampgeneratorone->sectionNavigationthis();
$tmp=$ampgeneratorone->sectionColImagethis();
Fluent operation, it changes the background color of the next section
$tmp=$ampgeneratorone->setBackgroundColorthis();
$tmp=$ampgeneratorone->setBgImagethis();
$tmp=$ampgeneratorone->setClassTextColorthis();
$tmp=$ampgeneratorone->setPaddingthis();
It reset to the default background color and text class
It renders the result page.
It renders the result to file
$tmp=$ampgeneratorone->genLinkthis();
Note: You could change the color. !
You could validate your amp on Google search validation