<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WEBPIRATEN &#187; Javascript</title>
	<atom:link href="http://webpiraten.de/index.php/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://webpiraten.de</link>
	<description>Techblog</description>
	<lastBuildDate>Sun, 05 Feb 2012 12:52:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>agavi output type overwrite in action</title>
		<link>http://webpiraten.de/index.php/frameworks/agavi-output-type-overwrite-in-action/</link>
		<comments>http://webpiraten.de/index.php/frameworks/agavi-output-type-overwrite-in-action/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 13:25:23 +0000</pubDate>
		<dc:creator>sägefisch</dc:creator>
				<category><![CDATA[Agavi]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[agavi]]></category>
		<category><![CDATA[container]]></category>
		<category><![CDATA[output]]></category>
		<category><![CDATA[overwrite]]></category>
		<category><![CDATA[set output type]]></category>
		<category><![CDATA[type]]></category>

		<guid isPermaLink="false">http://webpiraten.de/?p=337</guid>
		<description><![CDATA[um den output type einer agavi action auch nach dem routing zu ändern, kann man innerhalb der action den output type überschreiben.]]></description>
			<content:encoded><![CDATA[<p>um den output type einer agavi action auch nach dem routing zu ändern, kann man innerhalb der action den output type überschreiben.</p>
<pre class="brush: php; title: ; notranslate">

/**
 * assume that 'html' is the standard GET output for this action
 * when this action is called via POST you want to change the output type to 'json'
 * because on error or success you want to show small messages per json instead full html
 */
    public function executeRead(AgaviRequestDataHolder $rd)
    {
        return 'Input';
    }

    public function executeWrite(AgaviRequestDataHolder $rd)
    {
        $this-&gt;getContainer()-&gt;setOutputType($this-&gt;getContext()-&gt;getController()-&gt;getOutputType('json'));
        try
        {
            // do POST stuff
        }
        catch(Exception $e)
        {
            $this-&gt;setAttribute('message', $e-&gt;getMessage());
            return 'Error';
        }
        return 'Success';
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webpiraten.de/index.php/frameworks/agavi-output-type-overwrite-in-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fusion charts &#8211; schöne flash graphen kostenlos</title>
		<link>http://webpiraten.de/index.php/php/fusion-charts-schone-flash-graphen-kostenlos/</link>
		<comments>http://webpiraten.de/index.php/php/fusion-charts-schone-flash-graphen-kostenlos/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 16:45:09 +0000</pubDate>
		<dc:creator>sägefisch</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[charts]]></category>
		<category><![CDATA[diagramme]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[fusion charts]]></category>
		<category><![CDATA[graph]]></category>

		<guid isPermaLink="false">http://webpiraten.de/?p=298</guid>
		<description><![CDATA[hier könnt ihr euch fusioncharts ansehen (und downloaden) fusioncharts]]></description>
			<content:encoded><![CDATA[<p>hier könnt ihr euch fusioncharts ansehen (und downloaden)</p>
<p><a href="http://www.fusioncharts.com/free/demos/Blueprint/">fusioncharts</a></p>
]]></content:encoded>
			<wfw:commentRss>http://webpiraten.de/index.php/php/fusion-charts-schone-flash-graphen-kostenlos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>der Kohana Script Collector Helper</title>
		<link>http://webpiraten.de/index.php/frameworks/der-kohana-script-collector-helper/</link>
		<comments>http://webpiraten.de/index.php/frameworks/der-kohana-script-collector-helper/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 19:26:49 +0000</pubDate>
		<dc:creator>sägefisch</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Kohana]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[collector]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[kohana]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[stylesheet]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://webpiraten.de/?p=89</guid>
		<description><![CDATA[Um modular und agil in Kohana zu entwickeln, wurde ein Skript Kollektor notwendig, der aus allen Controllern (Template- oder Standard-Controllern) Skripte (CSS, Javascript) sammeln kann. Diese Scripte werden dann auf den jeweiligen Mastertemplates wieder an den richtigen Stellen eingebunden. Dazu &#8230; <a href="http://webpiraten.de/index.php/frameworks/der-kohana-script-collector-helper/">weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Um modular und agil in Kohana zu entwickeln, wurde ein Skript Kollektor notwendig, der aus allen Controllern (Template- oder Standard-Controllern) Skripte (CSS, Javascript) sammeln kann.</p>
<p>Diese Scripte werden dann auf den jeweiligen Mastertemplates wieder an den richtigen Stellen eingebunden.<br />
Dazu habe ich einen neuen Helper unter application/helpers/collector.php eingerichtet.</p>
<pre class="brush: php; title: ; notranslate">

class Collector_Core
{
    /**
     * Arrays containing URL's to scripts/styles (fill with standards)
     * @var string
     */
    static protected $scripts       = array();
    static protected $styles        = array();

    /**
     * Adds a url to store
     * @param string $file the local path to file
     * @return void
     */
    static public function addJs($file)
    {
        self::$scripts[] = $file;
    }

    /**
     * Adds a url to store
     * @param string $file the local path to file
     * @return void
     */
    static public function addCss($file)
    {
        self::$styles[] = $file;
    }

    /**
     * Generates/renders collectors items
     * @param boolean      $print whether to echo the output or just return rendered string
     * @return string      the rendered output
     */
    static public function renderJs($print = false)
    {
        $scripts    = array_unique(self::$scripts);
        $output     = html::script($scripts);
        if ($print)
        {
            echo $output;
        }
        else
        {
            return $output;
        }
    }

    /**
     * Generates/renders collectors items
     * @param boolean      $print whether to echo the output or just return rendered string
     * @param string|array $media type for this style (all, screen, print, media)
     * @return string      the rendered output
     */
    static public function renderCss($print = false, $media = 'all')
    {
        $styles = array_unique(self::$styles);
        $output = html::stylesheet($styles, $media);
        if ($print)
        {
            echo $output;
        }
        else
        {
            return $output;
        }
    }
} // end of Collector_Core
</pre>
<p>Dieser Helper kann nun aus allen Controllern heraus befüllt werden.</p>
<pre class="brush: php; title: ; notranslate">

class Welcome_Controller extends Template_Controller
{
    /**
     * set master template
     */
    public $template = 'master_default.tpl';

    /**
     * default constructor
     * @param void
     * @return void
     */
    public function __construct()
    {
        // load parent constructor
        parent::__construct();

        // collect scripts and styles
        collector::addCss('/css/fancybox');
        collector::addJs('/js/jquery.1.3.2');
        collector::addJs('/js/jquery.fancybox');
    }
    /** more code here */
} // end of Welcome_Controller
</pre>
<p>Nachdem nun alle relevanten Skripte eingesammelt wurden, kann man diese auf dem Template wieder ausgeben lassen.</p>
<pre class="brush: xml; title: ; notranslate">

&lt;?php collector::renderCss(true, 'all'); ?&gt;

&lt;!-- html code here --&gt;

&lt;?php collector::renderJs(true); ?&gt;
</pre>
<p>Der Kollektor sorgt dafür das keine doppelten Skripte geladen werden.</p>
]]></content:encoded>
			<wfw:commentRss>http://webpiraten.de/index.php/frameworks/der-kohana-script-collector-helper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

