Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your solution is writing a <code>script</code> tag somewhere into your HTML, depending on where your function is called. It differs greatly from Joomla! especially since it relies on the client to append the script to the head.</p> <p>In order to do something Joomla!-ish, you'll need to work with the <a href="http://www.php.net/manual/en/ref.outcontrol.php" rel="nofollow">output buffer</a>, or maybe a server-side equivalent of jQuery, like <a href="https://code.google.com/p/phpquery/" rel="nofollow">phpQuery</a>.</p> <p>For a simple case like yours, I'd use <em>phpQuery</em> as it makes things a lot easier for a jQuery coder.</p> <hr> <p><strong>A simple setup for your mini CMS</strong> could be like this. At its beginning, but the following, and do not use any HTML in your code unless you explicitly intend to.</p> <pre><code>phpQuery::newDocumentFileHTML('/path/to/template.html'); </code></pre> <p>It creates a new context for phpQuery by loading a template file into its memory and is <strong>required</strong>, but can be one of different variations. See the <a href="https://code.google.com/p/phpquery/wiki/Basics" rel="nofollow">Basics documentation</a>.</p> <p><strong>Function to append scripts:</strong></p> <pre><code>function loadJS( $name ) { pq('&lt;script&gt;')-&gt;attr('src', $name)-&gt;appendTo('head'); } </code></pre> <p>Nearly all methods available in jQuery are available in phpQuery as well. The only exception I've found so far is the <code>css</code> method, since it is impossible to know which styles will be rendered on client side without in-depth analysis of the linked stylesheets.</p> <p><strong>Finally, to write the DOM</strong> to your response:</p> <pre><code>echo pq('html'); </code></pre> <hr> <p>Whether it is your current approach or this one, the <code>jquery.pikachoose.js</code> script actually should work. Check your resources in your Developer Tools to see if it has been loaded. If so, check out if there were any errors related to your script that prevented it from loading up properly as a jQuery plugin.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload