MAIS

    Integrando arquivo PHP ao Joomla

    - Anúncio -
    - Anúncio -

     

    Esse tutorial vai ensinar como integrar um arquivo PHP externo aos dados do Joomla, podendo recuperar ou inserir dados de artigos, categorias e usuários.

    Para isso utilizamos o código abaixo:

    // Set flag that this is a parent file.
    define('_JEXEC', 1);
    define('DS', DIRECTORY_SEPARATOR);
    $path = "/var/www/public_html/";  //caminho absoluto do site
    define('JPATH_BASE', $path);
    require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php';
    require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php';
    
    $mainframe =& JFactory::getApplication('site');
     $db = &JFactory::getDBO();
     $mainframe->initialise();
    
    $user =& JFactory::getUser( );
    $user->name;

    Também podemos executar um sql a partir desse mesmo código, para isso leia o tutorial:

    Recuperar dados do  mysql

     

     

    - Anúncio -

    Artigos recentes

    Continue lendo

    DEIXE UMA RESPOSTA

    Please enter your comment!
    Please enter your name here