Recommend this page to a friend! |
![]() |
Info | Example | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 261 | All time: 7,803 This week: 37![]() |
Version | License | PHP version | Categories | |||
ampgeneratorone 1.0.1 | GNU Lesser Genera... | 5 | HTTP, PHP 5, Performance and optimiza... |
Description | Author | |
This package can generate HTML for using as Google AMP site. Innovation Award
|
|
<?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.
$url param $url ()
$tmp=$ampgeneratorone->fixRelativeUrlthis();
## Method genStructured
It generates the social and seo structure (Twitter card, Facebook OG and Google Schema)
$structured param StructureModel $structured (StructureModel)
$tmp=$ampgeneratorone->genStructuredthis();
## Method startAmp
Start to generate an Amp site.
$urls param LinkModel[] $urls (LinkModel[])
$tmp=$ampgeneratorone->sidebarthis();
## Method head
Generates the header navigation
$height param int $height (int)
$tmp=$ampgeneratorone->headthis();
## Method sectionFooter
It generates a footer of the amp site.
$param param FooterModel $param (FooterModel)
$tmp=$ampgeneratorone->sectionFooterthis();
## Method sectionAnalytics
Generates a Google Analytics section
$account UA-XXXXX-Y (string)
HeaderModel());
$tmp=$ampgeneratorone->sectionAnalyticsthis();
## Method sectionFirst
It draw a first section (hero style)
$content param SectionModel $content (SectionModel)
$tmp=$ampgeneratorone->sectionFirstthis();
## Method sectionImageButton
It generates a section with a single button.
$fullscreen param bool $fullscreen (bool)
$tmp=$ampgeneratorone->sectionImageButtonthis();
## Method sectionText
It generates a section with a text.
$content param SectionModel $content (SectionModel)
$tmp=$ampgeneratorone->sectionTextthis();
## Method sectionTextQuote
It generates a quote text
$content param SectionModel $content (SectionModel)
$tmp=$ampgeneratorone->sectionTextQuotethis();
## Method sectionUL
It generates an unsorted list section
$links param LinkModel[] $links (LinkModel[])
$tmp=$ampgeneratorone->sectionULthis();
## Method sectionOL
It generates a sorted list section
$links param LinkModel[] $links (LinkModel[])
$tmp=$ampgeneratorone->sectionOLthis();
## Method sectionButtons
It generates a section with one (or more than one) buttons.
$content param SectionModel $content (SectionModel)
$tmp=$ampgeneratorone->sectionButtonsthis();
## Method sectionCols
It generates a section with columns
$contents param SectionModel[] $contents (SectionModel[])
$tmp=$ampgeneratorone->sectionColsthis();
## Method sectionHeaderCentral
It generates a header central section. It could includes buttons.
$content param SectionModel $content (SectionModel)
$tmp=$ampgeneratorone->sectionHeaderCentralthis();
## Method sectionRaw
It generates a section with an image content.
$height param $height ()
$tmp=$ampgeneratorone->sectionImageContentthis();
## Method sectionImageContentLeft
It generates a section with a image content at the left.
$height param $height ()
$tmp=$ampgeneratorone->sectionImageContentLeftthis();
## Method sectionTable
It generates a table
$cols param array $cols (array)
$tmp=$ampgeneratorone->sectionTablethis();
## Method sectionImage
It generates an image. The size of the image is required to calculate the ratio
$height param int $height (int)
$tmp=$ampgeneratorone->sectionImagethis();
## Method sectionGMapFull
It generates a google map section. It can't be locate at the 30% top of the site (Amp restriction)
$placeholder param string $placeholder (string)
$tmp=$ampgeneratorone->sectionGMapFullthis();
## Method sectionGMapBoxed
It generates a google map (boxed) section. It can't be locate at the 30% top of the site (Amp restriction)
$googleMapUrl param string $googleMapUrl (string)
$tmp=$ampgeneratorone->sectionGMapBoxedthis();
## Method sectionNavigation
It generates a footer navigation
$navCol4 param LinkModel[] $navCol4 (LinkModel[])
$tmp=$ampgeneratorone->sectionNavigationthis();
## Method sectionColImage
It generates a section with images and text.
$maxCol param int $maxCol (int)
$tmp=$ampgeneratorone->sectionColImagethis();
## Method genModifyStyle
Fluent operation, it changes the background color of the next section
$color Example #ffffff,rgb(30,30,30),white (string)
$tmp=$ampgeneratorone->setBackgroundColorthis();
## Method setBgImage
Fluent operation, it changes the background image of the next section
$bgImage param string $bgImage (string)
$tmp=$ampgeneratorone->setBgImagethis();
## Method setClassTextColor
Fluent operation, it sets the class of the text
$class text-primary,text-secondary,text-success,text-info,text-warning,text-danger,text-white,text-black (string)
$tmp=$ampgeneratorone->setClassTextColorthis();
## Method setPadding
Fluent operation, it changes the padding
$bottom param $bottom ()
$tmp=$ampgeneratorone->setPaddingthis();
## Method resetDefault
It reset to the default background color and text class
It renders the result page.
It renders the result to file
$url param LinkModel|LinkModel[] $url (LinkModel|LinkModel[])
$tmp=$ampgeneratorone->genLinkthis();
## Method genButton
Generate the first link of an array only if array constains information or the link is not empty.
> Note: You could change the color. !
You could validate your amp on Google search validation
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
58% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.