Hot answers tagged

14

I'm not familiar with Widgets, so this may or may not be helpful. If you are writing a plugin, generally you don't need to parse your own template code. Simply call: $variables = array(array('name' => 'adrian')); $this->EE->TMPL->parse_variables($template, $variables); Which will parse any variables, loops, or conditionals inside your template....


11

The more methods you call (which is what you do with a plugin or module tag) the longer it will take to process it. So, as Eric said, yes. It will affect performance when you compare it to omitting it altogether. However, it's never as black and white as this. The amount of time a tag takes to process differs. It depends on all sorts of things. In the case ...


11

If I add a plugin like Widon't to nearly every content field on a page, will performance be impacted? Short answer: Yes The next question though: How much? My suggestion in times like these is to implement the plugin as intended and run metrics against with and without it. Use either siege or ab in the command line to test varying loads on the page. If ...


11

There are a couple of ways to create plugins which return entry IDs like that. The first, and most obvious, is for your plugin to return a pipe-separated list of entries, which is then passed to a channel entries tag. In your plugin file: $tag_vars = array(array('search_entry_ids' => '4|6|12|19')); $this->return_data = $this->EE->TMPL->...


11

The upgrade from EE2 to EE3 is a major step - from EE3 to EE4 not such a big one. So getting your site to EE3 is the thing to focus on. How hard this will be will very much depend upon how your EE2 site is set up, and in particular what add-ons you are using. To be able to upgrade to EE3 you need to get your copy of EE2 up to a late version (I think 2.10....


9

$variables[] = array('variable_name' => 'Your value'); $variables[] = array('variable_name' => 'Different Value'); $variables[] = array('variable_name' => 'Another one'); $this->return_data = $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $variables); It is important to not manually specify indexes for the $...


8

Admin_content extends the CI_Controller class, which is not designed to be instantiated like models and libraries within the MVC paradigm. You can however reuse the libraries within that controller. Unfortunately, the best method here may be to copy and paste your code into your own add-on do what you need. Obviously only copying the bare minimum amount of ...


8

You shouldn't be declaring functions inside your __construct() method. Move sliceurl a bit further down, and call it using $this->sliceurl (since it's part of your class): class Youtube_id_from_url { public $return_data = ""; public function __construct($urltag = NULL) { $this->EE =& get_instance(); if (empty($...


7

Nope - it's still an add-on. You can find it on github.


7

Your SQL query would look something like this: UPDATE exp_channel_titles SET author_id = XX WHERE entry_id IN(34,278,45,91, [...]); You'll want to run a Recount Statistics afterwards as well. (If there was something common to all of these entries, you could possibly incorporate more into the query that would prevent you from having to have a comma-...


7

Fixed it by changing this line: function usage() To this: public static function usage() Source: https://support.ellislab.com/bugs/detail/20352/plugins-through-php-warning-with-strict-errors-on


6

You probably don't need to build your own plugin for this. If that logic is all you have to worry about then Switchee and a couple of regular expressions are all you need. {exp:switchee variable="{segment_1}" parse="inward"} {!-- Seg 1 = empty. Embed homepage template. --} {case value="''"} {embed="embeds/homepage"} {/case} {!-- ...


6

According to http://uk1.php.net/preg_replace , the /e modifier was removed in PHP 5.5.0 . If you downgrade PHP to pre-5.5.0, then the error will go away. Alternatively, in your config.php file set error_reporting(E_ALL ^ E_DEPRECATED); to hide deprecated warnings. Alternatively, upgrade Textile - but it looks like http://devot-ee.com/add-ons/textile-editor-...


5

The full array of tag params is stored at $EE->TMPL->tagparams. So you can grab them like so: // Get the EE instance $EE = get_instance(); // Get all of the current tag params $all_params = $EE->TMPL->tagparams; From there you can loop through and find all of the params that begin with “search:” like this: // Find all of the search:xyz params $...


5

Unfortunately, and I use that statement loosely, I don't believe so. In fact, some of the WYSIWYG editors may even remove double spacing after a period. Why? Because, technically speaking its bad practice. Everyone who follows or attempts to follow the standard rules of typography, The Complete Manual of Typography: A Guide to Setting Perfect Type by James ...


5

I would suggest bundling all of your custom functionality for the project into one add-on (more on this thinking) - then you can use EE's helper implementation for this. (Have a look at the recommended add-on directory structure.) In your add-on package, add a helpers directory, and in it place one or more PHP files which contain your function(s). Be sure ...


5

Your EE tag can only output the jQuery snippet. It cannot run jQuery server-side and produce the width value for you to use. The jQuery snippet will run in the browser when the page loads, after the EE tag has rendered. You cannot gain access to a jQuery/client-side value in server-side code before the page has been rendered. You should just keep this in ...


5

Did you try using out_global like so: {exp:mx_jumper:out_global} {exp:channel:entries channel="blog" limit="1"} <h1>{title}</h1> {exp:mx_jumper:put name="test"}Move this content to outside the loop{/exp:mx_jumper:put} {/exp:channel:entries} {/exp:mx_jumper:out_global} {exp:mx_jumper:out name="test"} or you could also do: {exp:mx_jumper:...


5

There are a few possible solutions available here: 1. Global variable approach Amend your plugin so that it sets a global variable instead of/as well as returning the value directly. This ensures that it is parsed very early so you can use it as {cid} in tag parameters. You can set a global EE variable like this in your plugin: $this->EE->config->...


5

I was almost certain that Custom System Messages was causing this problem. The template offline message could be set in the preferences, but it was not. As Custom System Message has a greater priority over EE offline template, and no template was set, it was not working. The template was set inside Custom System Message The problem is solved.


5

Channel Images can do that and a lot of other neat stuff: http://www.devdemon.com/documentation/channel-images


5

The CE Image plugin has a watermark functionality (and much more), check 'watermark' on this page: http://www.causingeffect.com/software/expressionengine/ce-image/user-guide/parameters


4

Adrian's approach is certainly correct, but I should also add that I abstracted everything into Channel Data so you can parse things MUCH easier. Take a look at my Channel Data library, it makes a ton of things a lot easier. https://github.com/objectivehtml/Channel-Data $string = '{exp:navee:nav nav_title="main-nav"}'; $this->EE->load->driver('...


4

The short answer is that this add-on is fine. The longer answer is that you should be regularly monitoring the performance of the site as you are building it so that you are aware of issues when the appear. Use your template debugger and list of queries so that you can see what's going on with each page load and what might be eating up a lot of resources. ...


4

Unfortunately, there is no hook that runs after creating new categories, which is a shame. (You can find a list of available extension hooks here.) You could try writing an extension that uses the sessions_end hook, then checks for the various $_GET variables that indicate that you just created a new category, but that wouldn't account for times when ...


4

From what I can gather, I would simply get the field_id from the exp_channel_fields for the relevant relationship channel field that has been created inside EE CP. I would then insert both the pieces of content (the main piece of content and the relating content) into exp_channel_data as usual, then get the entry_id's for both pieces of content. Since EE 2 ...


4

You can use a custom query to fetch the titles and url_titles on the channel_titles table. It has a year, month and day column. If you need custom fields too, then you could only fetch the entry_id's and feed those to an embed, for a regular channel:entries tag. edit (example) On this day:<hr> {exp:query sql=" SELECT title, url_title, year ...


4

Take a look at the fetch_param() method in the Template library. There you can see all it does is return the value of the given key in the tagparams array, offering a fallback default. So, it should be completely safe, unless EllisLab decides to make it a private property, which I doubt they'll do.


4

Yes: use the sessions_end hook. It runs on every page load. Be sure to check to see if you're using it on the front-end before you set your cookie (I assume you want this for the front-end only). if(REQ != 'CP') { // do your stuff }


4

You want to use the EE->TMPL->parse_variables function. Here's an example block public function reggy() { $variables = array(); $tagdata = $this->EE->TMPL->tagdata; $variables[] = array('head_type' => 'horse mask'); return $this->EE->TMPL->parse_variables($tagdata, $variables); } You can define other replacement ...


Only top voted, non community-wiki answers of a minimum length are eligible