Note that there are some explanatory texts on larger screens.

plurals
  1. POString interpolation for expression in associative array
    primarykey
    data
    text
    <p>i have a definition like :</p> <pre><code>define('LIBRARIES_URI', get_template_directory_uri() . '/libraries/'); </code></pre> <p>Now, i have an associative array like :</p> <pre><code>array( 'name' =&gt; 'superfish-css', 'path' =&gt; LIBRARIES_URI .'superfish/css/superfish.css', 'type' =&gt; 'style' ) </code></pre> <p>However, path is not right, this gives me an error, because there is an expression i guess. I tried various things like double quotes and stuff, but i cannot seem to get it right without an external variable. Is there a way to correctly interpolate that ?</p> <p>FULL EXAMPLE :</p> <pre><code>define('LIBRARIES_PATH', TEMPLATEPATH . '/libraries/'); class Kosmos { private static $inclusions = array( array( 'name' =&gt; 'style.css', 'path' =&gt; "get_bloginfo('stylesheet_url')", 'type' =&gt; 'style' ), array( 'name' =&gt; 'jquery', 'path' =&gt; '', 'type' =&gt; 'script' ), array( 'name' =&gt; 'jquery-ui-core', 'path' =&gt; '', 'type' =&gt; 'script' ), array( 'name' =&gt; 'jquery-ui-tabs', 'path' =&gt; '', 'type' =&gt; 'script' ), array( 'name' =&gt; 'superfish-css', 'path' =&gt; LIBRARIES_URI .'superfish/css/superfish.css', 'type' =&gt; 'style' ), array( 'name' =&gt; 'superfish-js', 'path' =&gt; "LIBRARIES_URI . 'superfish/js/superfish.js'", 'type' =&gt; 'script', 'dep' =&gt; array('jquery') ), array( 'name' =&gt; 'superfish-hover', 'path' =&gt; "LIBRARIES_URI . 'superfish/js/hoverIntent.js'", 'type' =&gt; 'script', 'dep' =&gt; array('jquery') ), array( 'name' =&gt; 'jquery-color', 'path' =&gt; "LIBRARIES_URI . 'horizontalMenu/jquery.color-RGBa-patch.js'", 'type' =&gt; 'script' ), /* admin */ array( 'name' =&gt; 'admin-css', 'path' =&gt; "ADMIN_CSS_URI . 'admin.css'", 'type' =&gt; 'admin-style' ), array( 'name' =&gt; 'tabs-js', 'path' =&gt; "LIBRARIES_URI . 'tabs/tabs.js'", 'type' =&gt; 'admin-script' ) ); private static $admin_inclusions = array(); public function inclusions() { return self::$inclusions; } public function admin_inclusions() { return self::$admin_inclusions; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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