Como pegar o apelido do artigo?

  • allanppss
  • Avatar de allanppss Autor do Tópico
  • Offline
  • JCB! Estagiário
  • JCB! Estagiário
Mais
16 anos 3 semanas atrás #15878 por allanppss
allanppss replied the topic: Re: Como pegar o apelido do artigo?
brigado por responder elvisvinicius, eu tentei dessa forma mas não consegui, eu estou fazendo essa verificação no arquivo index.php na raiz do joomla, não estou criando componet nem modulo, é que dentro de cada artigo vai ter um swf padrão que puxa o titulo do artigo e de acordo com o titulo o swf padao carrega um outro swf

tem como eu pegar o id do artigo atual no index.php da raiz?

eu ja peguei tudo q queria, só falta isso agora, quando o cara se loga no site eu pego o id dele, agora só falta o id do artigo =/

se puder dar essa força eu agradeço
valew

Please Entrar ou Registrar to join the conversation.

Mais
16 anos 3 semanas atrás #15888 por elvisvinicius
elvisvinicius replied the topic: Re: Como pegar o apelido do artigo?

allanppss escreveu: eu estou fazendo essa verificação no arquivo index.php na raiz do joomla
...
tem como eu pegar o id do artigo atual no index.php da raiz?


Amigo, assim não vai funcionar. Esse index é o primeiro arquivo chamado, portanto é ele que inicia o framework do Joomla! Não vai conseguir nada nele. Faça isso no index.php do seu template. É nele que você vai conseguir, porque o framework do Joomla! já processou o conteúdo.

( ^ ^)

Please Entrar ou Registrar to join the conversation.

  • allanppss
  • Avatar de allanppss Autor do Tópico
  • Offline
  • JCB! Estagiário
  • JCB! Estagiário
Mais
16 anos 3 semanas atrás #15919 por allanppss
allanppss replied the topic: Re: Como pegar o apelido do artigo?
vlw pela dica, eu vou tentar aqui qualquer coisa dou um toque

Please Entrar ou Registrar to join the conversation.

  • allanppss
  • Avatar de allanppss Autor do Tópico
  • Offline
  • JCB! Estagiário
  • JCB! Estagiário
Mais
16 anos 3 semanas atrás #15927 por allanppss
allanppss replied the topic: Re: Como pegar o apelido do artigo?
dá pra eu pegar o titulo ou apelido do artigo sem precisar acessar o banco de dados?

variavel $title sei la

Please Entrar ou Registrar to join the conversation.

Mais
15 anos 4 meses atrás #32493 por paulocorrea
paulocorrea replied the topic: Re: Como pegar o apelido do artigo?
Tem o seguint script (plugin para postar no twitter).

[color=#FF0000:1l0hlysn]O problema é que o $id está retornando 0 (zero).[/color:1l0hlysn]

<?php
/**
* @Copyright Copyright (C) 2010- Gary Teh Name1price.Com
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
**/
// Check to ensure this file is included in Joomla!
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once(JPATH_SITE.DS.'plugins'.DS.'content'.DS.'class.twitter.php');
jimport( 'joomla.plugin.plugin' );
jimport('joomla.application.component.controller');
/**
* Example Content Plugin
*
* @package Joomla
* @subpackage Content
* @since 1.5
*/
class plgContentTwitter extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param object $params The object that holds the plugin parameters
* @since 1.5
*/
function plgContentTwitter( &$subject, $params )
{
parent::__construct( $subject, $params );
}
/**
* Example prepare content method
*
* Method is called by the view
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
*/
function onPrepareContent( &$article, &$params, $limitstart )
{
global $mainframe;
}
/**
* Example after display title method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onAfterDisplayTitle( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example before display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onBeforeDisplayContent( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example after display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onAfterDisplayContent( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example before save content method
*
* Method is called right before content is saved into the database.
* Article object is passed by reference, so any changes will be saved!
* NOTE: Returning false will abort the save with an error.
* You can set the error by calling $article->setError($message)
*
* @param object A JTableContent object
* @param bool If the content is just about to be created
* @return bool If false, abort the save
*/
function onBeforeContentSave( &$article, $isNew )
{
global $mainframe;
$twitter_id = $this->params->_registry->twitter_id;
if(strlen($twitter_id) == 0 || !isset($twitter_id ))$twitter_id = "";
$twitter_password = $this->params->_registry->twitter_password;
if(strlen($twitter_password ) == 0 || !isset($twitter_password )) $twitter_password = "";
echo " $twitter_id , $twitter_password ";

//
Obter o id do artigo
$get = JRequest::get('get');
$id = (int) $get;


//
Criar o link
$url = JURI::root().'index.php?option=com_content&view=article&id=' . $id;
print $url;
exit();

if($isNew ){
$tweet = new Twitter($twitter_id , $twitter_password );
$my_tinyurl = $this->get_tiny_url($url);
$success = $tweet->update(substr ( $article->title , 0 , 100)." ".$my_tinyurl );
echo "[$success]";
}
else{
$tweet = new Twitter($twitter_id , $twitter_password );
$my_tinyurl = $this->get_tiny_url($url);
$success = $tweet->update("Updated : ".substr ( $article->title , 0 , 100)." ".$my_tinyurl );
echo "[$success]";
}
//exit();
return true;
}
/**
* Example after save content method
* Article is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved
*
*
* @param object A JTableContent object
* @param bool If the content is just about to be created
* @return void
*/
function onAfterContentSave( &$article, $isNew )
{
global $mainframe;
return true;
}
function get_tiny_url($url) {
/*
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,' tinyurl.com/api-create.php?url='.$url );
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
*/
$data = (trim(file_get_contents(' tinyurl.com/api-create.php?url='.$url )));
if(!$data) return $url;
return $data;
}
}

[color=#0000BF:17eu9wmx]Em Cristo,

Paulo Corrêa
[url:17eu9wmx]http://justificacaopelafe.com.br[/url:17eu9wmx]
O SENHOR te abençoe e te guarde (Números 6.24)[/color:17eu9wmx]

Please Entrar ou Registrar to join the conversation.