Skip to content

Instantly share code, notes, and snippets.

@estefanionsantos
Created April 10, 2022 17:03
Show Gist options
  • Save estefanionsantos/2216efde98bf9e45b083de8a95cab751 to your computer and use it in GitHub Desktop.
Save estefanionsantos/2216efde98bf9e45b083de8a95cab751 to your computer and use it in GitHub Desktop.
image element
<?php
use Rubricate\Element\CreateElement;
$i1 = new CreateElement('img');
$i1->setAttribute('src', 'image.png');
$i2 = new CreateElement('img');
$i2->setAttribute('src', 'image.png');
$i2->setAttribute('class', 'img-circle');
$i3 = new CreateElement('img');
$i3->setAttribute('src', 'image.png');
$i3->setAttribute('style', 'border: 0');
$a3 = new CreateElement('a');
$a3->setAttribute('href', '#');
$a3->addChild($i3);
echo $i1->getElement();
echo $i2->getElement();
echo $a3->getElement();
/*
<img src="image.png" />
<img src="image.png" class="img-circle" />
<a href="#"><img src="image.png" style="border: 0" /></a>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment