http://codeigniter.com/user_guide/general/libraries.html

Esse caso é usado mais para recuperar a instância super objeto Codeigniter
dentro da library que você criou, por exemplo (ou helper, etc).

*Utilizing CodeIgniter Resources within Your Library*
To access CodeIgniter's native resources within your library use the
get_instance() function. This function returns the CodeIgniter super object.
http://codeigniter.com/user_guide/general/creating_libraries.html

Eu, particularmente, gosto de manter na linha, evitando de "funcionou,
deixa!" ehehehehe
Mas tá de boa. Foi só uma observação. ;-)


Att,
Vinicius Cruz
http://twitter.com/vinaocruz
http://www.zime.com.br/


Em 20 de agosto de 2010 01:00, Allan Torres ( Hazi)
<[email protected]>escreveu:

> Vinicius,
> Na verdade sempre li nos guias do CI que a forma correta era :
>       $CI =& get_instance();
>
> Porém, sou muito prático nesse sentido, funcionou ? se funcionou não tem
> problema, como dizem, existem varias formas de se fazer nescau.
> Depois envio outras libs, pra falar a verdade vou colocar no Git que é mais
> facil, rola ate uns updates e tal, acho q é melhor :)
>
>
>
> Allan
>
>
> On Fri, Aug 20, 2010 at 12:56 AM, Vinicius Cruz <[email protected]>wrote:
>
>> Legal, fiz uma parecida num projeto :-)
>>
>> Só uma detalhe construtivo, como é uma library, no controllers usariamos
>> assim: (correto?)
>>
>> <?php
>> $this->load->library('Youtube');
>> echo $this->youtube->EmbedVideo($DS_URL,$width,$height);
>> ?>
>>
>> Att,
>> Vinicius Cruz
>> http://twitter.com/vinaocruz
>> http://www.zime.com.br/
>>
>>
>> 2010/8/19 Allan Torres ( Hazi) <[email protected]>
>>
>>>  Galera, finalmente uma lista interessante, e bom estar aqui viu!
>>> So pra compartilhar, se alguem estiver precisando, uma biblioteca que
>>> visualiza videos do youtube, fiz pra um projeto meu esses dias.
>>>
>>> Salvar como Youtube.php
>>> <?php if (!defined('BASEPATH')) exit('Acesso negado');
>>>
>>> class Youtube {
>>>
>>>     function EmbedVideo($videoid,$width = 425,$height = 350) {
>>>         return '<object width="'.$width.'" height="'.$height.'"><param
>>> name="movie" 
>>> value="http://www.youtube.com/v/'.$videoid.<http://www.youtube.com/v/%27.$videoid.>'"></param><param
>>> name="wmode" value="transparent"></param><embed src="
>>> http://www.youtube.com/v/'.$videoid.<http://www.youtube.com/v/%27.$videoid.>'"
>>> type="application/x-shockwave-flash" wmode="transparent" width="'.$width.'"
>>> height="'.$height.'"></embed></object>';
>>>     }
>>>
>>>     function GetImg($videoid,$imgid = 1) {
>>>         return "http://img.youtube.com/vi/$videoid/$imgid.jpg";;
>>>     }
>>>
>>>     function ShowImg($videoid,$imgid = 1,$alt = 'Video screenshot') {
>>>         return "<img src='".$this->GetImg($videoid,$imgid)."' width='96'
>>> height='66' border='0' alt='".$alt."' title='".$alt."' />";
>>>     }
>>>
>>> }
>>>
>>> ?>
>>>
>>>
>>> Como usar:
>>>              <?
>>>                             $width = 364;
>>>                             $height = 273;
>>>
>>>                             //Escrevendo video atraves da Lib Youtube
>>>                             $CI =& get_instance();
>>>                             $CI->load->library('Youtube');
>>>                             echo
>>> $CI->youtube->EmbedVideo($DS_URL,$width,$height);
>>>                             ?>
>>>
>>>
>>>
>>> Falows, precisando ai galera, to por aqui ! :)
>>>
>>> --
>>> Allan Torres
>>>
>>>
>>> _______________________________________________
>>> [email protected]
>>> http://www.codeigniter.com.br
>>> http://codeigniter.com.br/mailman/listinfo/lista_codeigniter.com.br
>>>
>>> ---------------------------
>>> Oportunidade de negócio
>>> http://www.franquiasargohost.net
>>> ---------------------------
>>>
>>>
>>
>> _______________________________________________
>> [email protected]
>> http://www.codeigniter.com.br
>> http://codeigniter.com.br/mailman/listinfo/lista_codeigniter.com.br
>>
>> ---------------------------
>> Oportunidade de negócio
>> http://www.franquiasargohost.net
>> ---------------------------
>>
>>
>
>
> --
> Allan Torres
>
>
> _______________________________________________
> [email protected]
> http://www.codeigniter.com.br
> http://codeigniter.com.br/mailman/listinfo/lista_codeigniter.com.br
>
> ---------------------------
> Oportunidade de negócio
> http://www.franquiasargohost.net
> ---------------------------
>
>
_______________________________________________
[email protected]
http://www.codeigniter.com.br
http://codeigniter.com.br/mailman/listinfo/lista_codeigniter.com.br

---------------------------
Oportunidade de negócio
http://www.franquiasargohost.net
---------------------------

Responder a