mootools + PHP = mooHP

noviembre 3, 2007 at 8:02 pm 13 comentarios

mooTools es un framework javascript que ha crecido de una forma basta abrupta, por lo mismo hoy en día es uno de los frameworks mas importantes y usados por desarrolladores. Pero se imaginan programar de la misma forma que mooTools pero en PHP?, pues ya es un hecho y se llama mooHP.

mooHP es un novedoso framework con la particularidad de que su sintaxis es idéntica a la de mooTools, novedoso no?. Así que si tu eres uno de los adeptos a mooTools y aun no te acostumbras a otros frameworks PHP, este puede ser tu punto de partida sin tener que pasar por un gran esfuerzo intentando conocer una sintaxis nueva.

Mírenlo ustedes mismo.

<?php
include("mooHP2/dom.class.php");
include("mooHP2/element.class.php");
include("mooHP2/css.class.php");
include("mooHP2/utility.class.php");

//New instance of the dom class
$t = new dom();

//Loads a template from file
$t->loadFile("base.html");

//Gets element by css selector  and sets it's HTML content.
$t->SE("body")->setHTML("");

//Selected ellement: body adopts  new element
$t->SE("body")->adopt( $t->element("div", array("id"=>"header") ,"Hello world!") );

//Body adopts  <br />
$t->SE("body")->newLine();

$picked = "";
if (isset( $_GET["cd"] )) {
 $picked = " you have selected #".$_GET["cd"];
}

//Body adopts new element div: with assigned properties as second argument and text as content;
$t->SE("body")->adopt( $t->element("div", array("style"=>"margin:10px; padding:10px; border:1px solid #444;"), "Counting down:".$picked) );

// $select  = new Element()
$select = $t->element("select", array("name"=>"cd"), "");

//Body adopts new element of type form
$t->SE("body")->adopt( $t->element("form", array("id"=>"newForm","method"=>"get") ) );
//Selects new element by ID and adopts previously defined element $select
$t->S("newForm")->adopt( $select );
// #newForm adopts new Element input
$t->S("newForm")->adopt( $t->element("input", array("type"=>"submit", "value"=>"CLICK!") ) );

for ($i=1; $i<=20; $i++) {
	//$newOption is new option element
	$newOption = $t->element("option", array("value"=>$i), "Count down: " . $i );
	//$select adopt as it's first child the $newOption element
	$select->adoptTop( $newOption );
	if ( isset($_GET["cd"]) && $_GET["cd"] == $i ) {
		//Setting an attribute to an element
		$newOption->setProperty("selected","selected");
	}
}

//Body accepts  new style rules
$t->SE("body")->setStyle("margin","10px");

//Body adopts <br/>
$t->SE("body")->newLine();

//Appending text to the body
$t->SE("body")->appendText("and here comes the appended text");

//Body is adopting the inc.html contents
$t->SE("body")->adopt( $t->includeFile("inc.html") );

if (!isset( $_GET["cd"] )) {
	//Make simple alert with javascript
	$t->alert("Hello and welcome to mooHP");
}

//Setting the <title> tah innerHTML
$t->setPageTitle("..:: Hello and welcome to mooHP ::..");

//Creating new instance of the css class
$newCss = new css();
//Setting rule in css
$newCss->setStyle("color","#ff9900");
//Setting rules in css
$newCss->setStyles(array("font-weight"=>"bold","font-size"=>"24px" ));
//Writing the defined css to element
$newCss->writeToElement( $t->S("header") );

//Creating new instance of the css class
$newCss2 = new css();
//Setting rule in css
$newCss2->setStyle("border","10px solid #DDD");
//Setting rule in css
$newCss2->setStyle("padding","10px");
//Writing the defined css as #newForm selector in $t dom instance
$newCss2->writeToDom("#newForm", $t);

//Writing the page   if true is passed as argument the page will be compresed
$t->writePage(true);

?>

En lo personal no lo he probado, ya que es un framework bastante nuevo, así que si alguno de ustedes lo ha ocupado, seria bueno saber que tal les fue, cuales fueron sus impresiones, etc. Como última nota, mooHP funciona sobre versiones 5.2.1 de PHP en adelante.

Demo | Descarga | Artículo relacionado
.

Ver VideosTe VerdeImagenes para hi53GP

Entry filed under: Curiosidades, mooTools, PHP, Programación, Recursos. Tags: , , , .

800+ brushes para photoshop Meme: “héroes” o inspiraciones dentro del bloggin

13 comentarios Add your own

  • 1. RSI Sistemas  |  noviembre 4, 2007 a las 3:14 pm

    Muy bueno el post!!!

    Responder
  • 2. [Ajax-Php] mooHP: Mootools y Php | Ajaxman  |  abril 28, 2008 a las 11:47 am

    […] | mootools + PHP = mooHP Descarga | Descargar MooHP Mas información en | […]

    Responder
  • 3. norman784  |  mayo 12, 2008 a las 9:53 am

    segun comentan no es tan bueno, ya que usas demasiado codigo para hacer poco, ademas de ser complicado de mantener, a mi parecer no es tan buen punto de partida.. el mejor punto de partida es la programacion artesanal, sin frameworks…. pero si queres uno, proba el zend (dicen q es bueno, yo no lo uso), cake (parece prometedor, lo estoy probando) o code igniter (tambien parece muy prometedor y es facil de usar).. el symphony tambien es super bueno, pero es bastante complicado su uso…

    Responder
  • 4. Basketball Program  |  diciembre 26, 2012 a las 6:55 pm

    Your style is so unique in comparison to other people I have read stuff from.
    Thank you for posting when you have the opportunity, Guess I
    will just bookmark this web site.

    Responder
  • 5. how is the best way to lose belly fat  |  febrero 12, 2013 a las 5:02 am

    It’s very straightforward to find out any topic on web as compared to textbooks, as I found this post at this website.

    Responder
  • 6. this jump manual review  |  marzo 20, 2013 a las 8:50 am

    WOW just what I was looking for. Came here by searching for supplements
    for fat loss

    Responder
  • 7. women\47s apparel  |  mayo 1, 2013 a las 4:12 am

    Twenty five percent space of the town is under the green cowl that makes this city additional viable
    and recent particularly within the monsoon season.
    ” and for the duration of the take, (s)he is an audience member sitting in the theatre or their couch at home. The sale for Samsung Galaxy S has reached 10 millionth mark, thus making it the most successful Android smartphone so far.

    Responder
  • 8. canadian insurance auto  |  mayo 7, 2013 a las 7:27 am

    If you are not ready to fight with yourself, to say
    “NO” to things you liked to do or which were just a habit to you then
    nothing on Earth will help you to get rid of those excess pounds.
    Uncooked ginkgo biloba seeds have shown some
    small levels of toxins, so if you prefer the seeds
    it is advised to cook them prior to ingestion.
    Aided by the Pills rapidly getting best tablet pc all of the direct device
    when using the iphone, it is really distinct that we should expect to witness it develop worldwide recognition for countless years.

    Responder
  • 9. zahnbleaching  |  junio 2, 2013 a las 6:43 pm

    I found your weblog website on google and test a couple of of
    your early posts. Proceed to maintain up the very good operate.
    I just extra up your RSS feed to my MSN Information Reader.
    Searching for ahead to reading more from you later on!…

    Responder
  • 10. wasserbettenauflage  |  junio 13, 2013 a las 12:44 pm

    There are some attention-grabbing closing dates in this article but I don’t know
    if I see all of them heart to heart. There’s some validity but I will take hold opinion till I look into it further. Good article , thanks and we wish extra! Added to FeedBurner as nicely

    Responder
  • 11. multifunktionswerkzeug  |  junio 16, 2013 a las 11:28 pm

    Excellent weblog right here! Additionally
    your web site a lot up very fast! What web host are you the usage
    of? Can I get your associate link in your host?
    I want my website loaded up as quickly as yours lol

    Responder
  • 12. [Ajax-Php] mooHP: Mootools y Php Ajaxman  |  octubre 29, 2013 a las 4:34 pm

    […] | mootools + PHP = mooHP Descarga | Descargar MooHP Mas información en | […]

    Responder
  • 13. Even more Additional bonuses  |  octubre 21, 2014 a las 9:31 pm

    Even more Additional bonuses

    mootools + PHP = mooHP | Quest’s Blog

    Responder

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

Trackback this post  |  Subscribe to the comments via RSS Feed



A %d blogueros les gusta esto: