You're right Chris, here's my code, hope you guys spot something I'm
doing wrong.

This is the regular PHP file, which works fine:

links.php
<?php
header("Content-type: application/x-javascript" );
echo "document.write(\"<div id='mi_sabrosus'>\");\n";
echo "  document.write(\"<ul>\");\n";
echo "    document.write(\"<li><a title='Dicas do Augusto Campos para
ganhar dinheiro com progandas do Google'
href='http://br-linux.org/linux/usando-o-google-adsense-para-gerar-recursos-para-o-seu-projeto-livre'>Usando
o Google Adsense para gerar recursos para o seu projeto livre |
BR-Linux.org</a></li>\");\n";
echo "    document.write(\"<li>Mais em <a title='links'
href='http://links.pittlandia.net'>links</a>\");\n";
echo "  document.write(\"</ul>\");\n";
echo "document.write(\"</div>\");\n";
?>

These are the files I use in my cake app, which is not working:

badge.thtml (layout)
<?php
header("Content-type: text/javascript");
echo $content_for_layout;
?>

recent.thtml (view)
<?php
echo "document.write(\"<div id='mi_sabrosus'>\");\n";
echo "  document.write(\"<ul>\");\n";
foreach ($links as $link):
  echo "    document.write(\"<li><a
title='".utf8_decode($link['Link']['description'])."'
href='".$link['Link']['url']."'>".utf8_decode($link['Link']['title'])."</a></li>\");\n";
endforeach;
echo "    document.write(\"<li>Mais em <a
title='".$siteConfig['nome_sistema']."'
href='".$siteConfig['link_sistema']."'>".$siteConfig['nome_sistema']."</a></li>\");\n";
echo "  document.write(\"</ul>\");\n";
echo "document.write(\"</div>\");\n";
?>

links_controller.php (controller, only showing the recent action)
function recent($quant = 5)
{
    $this->layout = 'badge';
    if (!empty($this->params['url']['q']))
    {
        $quant = $this->params['url']['q'];
    }
        $links = $this->Link->getLinks($quant);
        $this->set('links', $links);
}

And finally, this is the page that tests the inclusion of the outputed
code in both methods:

links.html
<html>
<head>
  <title>Teste de Links via Javascritp</title>
</head>
<body>
<p>Testando...</p>
<script src="http://links.pittlandia.net/links/recent?q=5";
type="text/javascript"></script>
<p>Testando de novo...</p>
<script src="http://www.pittlandia.net/links.php";
type="text/javascript"></script>
<p>Acabou o teste</p>
</body>
</html>

You can try out for yourself by going to:
http://www.pittlandia.net/links.html

Thanks in advance,
Rodrigo.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to