This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In ft.assets.php add this to the top of the pre_process function: | |
/** | |
* Pre Process | |
*/ | |
function pre_process() | |
{ | |
// ------------------------------------------- | |
// Get the exp_assets_entries rows | |
// ------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{exp:switchee variable="{segment_1}/{segment_2}/{segment_3}" parse="inward"} | |
{case value = "//"} | |
{!-- s1, s2 and s3 are empty - Show home page --} | |
{embed="site/_home"} | |
{/case} | |
{case value="#^products/\S+/\S+$#"} | |
{!-- s1 is 'products', s2 and s3 are not empty - Show single products --} | |
{embed="site/_product"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!-- The URL structure is like this /wiki/{category}/{url_title}/ | |
If I fill in random characters for the {url_title}, {no_results} should be TRUE. | |
I've verified through the Template debugger that it does indeed return "No results", but the redirect @L91 to the 404 does not work. Is there a problem with the parse order, or is it something with Switchee/Stash? | |
Thanks! | |
---------------------------------------------------------------------------------------- --} | |
{exp:stash:set name="wiki_navigation" type="snippet" parse="inward"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently you're stuck if you need to return JSONP from a EE template, because appending callback=? to your uri will make EE throw an Invalid Get Date error. In case you didn't know, JSONP is a great way to do cross-domain AJAX and let your EE website function as a web service. | |
To get round this restriction in EE 2.4 amend line 116 of /system/expressionengine/core/EE_Input.php from: | |
elseif (preg_match("#(;|\?|exec\s*\(|system\s*\(|passthru\s*\(|cmd\s*\(|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $val)) | |
To: | |
elseif (preg_match("#(;|\?\S+|exec\s*\(|system\s*\(|passthru\s*\(|cmd\s*\(|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $val)) | |
This still gives you protection against the use of ? in query strings to pass arguments, but allows you to append a ? to the very end of your query only - which is all we need. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will add an 'Assets' fieldtype to Taxonomy. | |
Caveats: | |
* only images will be visible in the Assets sheets | |
* only one image can be selected | |
* shows all file upload locations that the user's member group can access | |
* stores the actual image url NOT the Assets path eg {filedir_1}my_image.jpg. | |
Iain - you might want to implement Assets path {filedir} parsing for your Taxonomy module | |
tags and then store the Assets url instead (which is in files[0].path). Then users can move | |
the image in Assets and it won't break the link... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have a new tag {exp:stash:embed} which allows you to include Stash template files and store | |
in the database. Files can be fully or partially parsed when read before saving (set), OR | |
saved and then parsed on retrieval (get). Stash variables can be accessed in the Stash | |
template files as {stash:variable} and of course all the usual {global_variables} work as | |
expected. | |
An example: | |
{exp:stash:embed | |
name="news_listing" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Put parameters on separate lines, and be consistent in the use of quotes: double quotes for params on the main tag, single quotes for params in the tag passed as a parameter: | |
{exp:stash:set_value | |
name="ref" | |
type="snippet" | |
output="no" | |
value="{exp:stash:get name='ref_{entry_id}' type='snippet'}" | |
parse="inward" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the viewModel: | |
{exp:stash:set name="nav_main" parse_tags="yes" save="yes" refresh="60" replace="no" scope="site"} | |
{exp:taxonomy:nav tree_id="1" depth="1" ul_css_id="my-id"} | |
<a href="{node_url}"{stash:nocache}{if "{exp:stash:get name='segment_1' type='global'}" == "{/stash:nocache}{node_url}{stash:nocache}"} class="active"{/if}{/stash:nocache}>{node_title}</a> | |
{/exp:taxonomy:nav} | |
{/exp:stash:set} | |
(I'm assuming Taxonomy {node_url} is something like 'my_page' NOT 'www.mysite/my_page', so that we can compae it to {segment_1}- if it produces something else adjust the conditional above accordingly) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -------------------------------------------------------------------- | |
/** | |
* Returns the first node_id for a given template path | |
* @param string template_path | |
* @return int node_id, | |
* but if no rows returned, false | |
*/ | |
function get_node_id_from_template_path($template_path) | |
{ |
OlderNewer