This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function joomlaPassword($password) { | |
$password= base64_decode($password); | |
$salt = md5(mt_rand()); | |
$encrypt = md5($password . $salt); | |
return $encrypt . ':' . $salt; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getCats() | |
{ | |
$db = JFactory::getDBO(); | |
$query = $db->getQuery(true); | |
$query->select('a.id, a.title, a.level'); | |
$query->from('#__categories AS a'); | |
$query->join('LEFT', $db->quoteName('#__categories').' AS b ON a.lft > b.lft AND a.rgt where('a.extension = "com_content"'); | |
$query->where('a.published IN (0,1)'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// cogemos imagen de introtext | |
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $this->item->introtext, $src); | |
$first_img = $src[1][0]; | |
if(!empty($src[1][0])){ | |
echo '<div class="first_img"><img src="'.$src[1][0].'" alt="" /></div>'; | |
} | |
// quitamos todas las imágenes de introtext | |
$re_cleanImages = '/<img[^>]*>/'; | |
$myCleanHtml = preg_replace($re_cleanImages,'',$this->item->introtext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// eliminamos enlaces | |
$myCleanHtml = filter_var($this->item->introtext, FILTER_SANITIZE_STRING); | |
// recortamos texto a 200 caracteres | |
if (strlen($myCleanHtml) > 200){ | |
echo substr($myCleanHtml,0,200).'...'; | |
}else{ | |
echo $myCleanHtml; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
jimport( 'joomla.application.module.helper' ); | |
$module = JModuleHelper::getModule('mymodulename'); | |
$moduleParams = new JRegistry(); | |
$moduleParams->loadString($module->params); | |
// Ahora podemos llamar al parámetro | |
$param = $moduleParams->get('paramName', 'defaultValue'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
JHtml::_('jquery.framework'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$uri = & JFactory::getURI(); | |
$absolute_url = $uri->toString(); | |
echo $absolute_url; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Básico | |
<?php $menu = & JSite::getMenu(); | |
if ($menu->getActive() == $menu->getDefault()) { | |
echo 'This is the front page'; | |
} ?> | |
// Multi-idioma | |
<?php | |
$app = JFactory::getApplication(); | |
$menu = $app->getMenu(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Editar fichero components\com_content\router.php | |
// Dentro de función ContentBuildRoute(&$query) | |
// Cambiar $advanced = $params->get('sef_advanced_link', 0); por | |
$advanced = $params->get('sef_advanced_link', 1); | |
// Dentro de función ContentParseRoute($segments) | |
// Cambiar $advanced = $params->get('sef_advanced_link', 0); por | |
$advanced = $params->get('sef_advanced_link', 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
JPATH_ADMINISTRATOR The path to the administrator folder. | |
JPATH_BASE The path to the installed Joomla! site. | |
JPATH_CACHE The path to the cache folder. | |
JPATH_COMPONENT The path to the current component being executed. | |
JPATH_COMPONENT_ADMINISTRATOR The path to the administration folder of the current component being executed. | |
JPATH_COMPONENT_SITE The path to the site folder of the current component being executed. | |
JPATH_CONFIGURATION The path to folder containing the configuration.php file. | |
JPATH_INSTALLATION The path to the installation folder. | |
JPATH_LIBRARIES The path to the libraries folder. |
OlderNewer