Cómo obtener el último valor de un array en PHP

Si queremos obtener el último valor de un array en PHP podemos utilizar la funcion end().

Por ejemplo, si tenemos el siguiente array:

<?php
$frag = array(
'num' => array(
                   '1' => '1',
                   '2' => '2',
                   '3' => '3'
                   )
 );
?>

Si queremos mostrar el último valor podemos utilizar la funcion end() de la siguiente forma:

<?php
$ultimo = end( $frag['num'] );
echo $ultimo;
?>

Lo cual nos dará como resultado: 3

Cómo poner código en WordPress: SyntaxHighlighter Evolved

Para poner código en WordPress tenemos el siguiente plugin: SyntaxHighlighter Evolved. También hemos instalado la extensión para PHP5.

Cómo poner código PHP con SyntaxHighlighter Evolved:

Nos situamos en el editor en HTML (no en Visual) y escribimos el código PHP entre las etiquetas [php] y [/php]:

<?php
$numero=1;
echo $numero;
?>

Cómo poner código HTML con SyntaxHighlighter Evolved:

Nos situamos en el editor en HTML (no en Visual) y escribimos el código HTML entre las etiquetas [html] y [/html]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>PHP Code Example</title>
</head>
<body>
    <h1>PHP Code Example</h1>
 
    <p><?php echo 'Hello World!'; ?></p>
 
    <p>This line is highlighted.</p>
 
    <div class="foobar">
        This    is  an
        example of  smart
        tabs.
    </div>
 
    <p><a href="http://wordpress.org/">WordPress</a></p>
</body>
</html>

Formulario PHP para cargar datos en la misma página

Si queremos crear un formulario en PHP donde se carguen los datos en la misma página podemos utilizar lo siguiente:

<?php

if(isset($_POST['submit']))

{

$name = $_POST['name'];

echo "User Has submitted the form and entered this name : <b> $name </b>";

echo "<br>You can use the following form again to enter a new name.";

}

?>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<input type="text" name="name"><br>

<input type="submit" name="submit" value="Submit Form"><br>

</form>

Para más información:

http://www.html-form-guide.com/php-form/php-form-action-self.html

Redirección permanente de una web antigua a una nueva web

En un proyecto que ha transformado totalmente la web antigua he tenido que redireccionar cualquier entrada a la web antigua al inicio de la web nueva.

Es muy sencillo gracias al .htaccess, sólo tenemos que escribir en ese archivo:

redirectMatch 301 ^(.*)$ nueva_web

301 significa que es una redirección permanente.

Por ejemplo, quisieramos redirigir a Google toda la web escribiríamos lo siguiente:

redirectMatch 301 ^(.*)$ http://www.google.es

Esto nos asegura que cualquier archivo en la raíz de sitio o en cualquier directorio será redirigido a la página que queramos.

2011 Open Source Awards

En Noviembre de 2011 salieron los ganadores y finalistas de los proyectos de código abierto (Open Source) quedando así:

Categoría Ganador
Open Source CMS Joomla! Drupal Plone
Open Source Mobile Toolkits and Libraries jQuery Mobile PhoneGap Sencha Touch
Most Promising Open Source Project ImpressPages Seo Panel Chamilo
Open Source Business Applications PrestaShop nopCommerce OpenCart
Open Source JavaScript Libraries jQuery Dojo Toolkit Sencha (Ext JS)
Open Source Multimedia Software Blender GIMP Inkscape

The Open Source CMS subcategory

  • Best Open Source CMS for Performance: Drupal
  • Best .NET Open Source CMS: DotNetNuke
  • Best CMS for Best Community: Drupal
  • Best CMS for Ease of Use: Drupal

The Open Source JavaScript Libraries subcategory

  • Best JavaScript Library for plug-ins: jQuery
  • Best JavaScript Library for Effects and animations ability: jQuery
  • Best JavaScript Library Community: jQuery
  • Best JavaScript Library for Performance: jQuery