Hot answers tagged

18

Hooks are rather abstract and require you to have a working plugin/module with your own hooks setup. So before you go any further I would be sure you have a good grasp on how to use the most basic forms of hooks. It might be wise to even write a simple extension just to go through the process. Postmaster extends ExpressionEngine's native handling of hooks. ...


9

Ok, this is something it looks like Ellis is not ready to really let people do even though it's in documentation, except perhaps developers who would provide via a full add-on installer and handling. However, it is possible. a. First, there is an EE interface to install new button features, but it is not called anywhere, Addons_installer:install_rte_tool. ...


8

The ‘p’ in your module’s class name must be lowercased. From http://ellislab.com/expressionengine/user-guide/development/modules.html#the-core-module-file-mod-module-name-php: The Core Module file is used for outputting content via Templates and doing any processing that is required by both the Control Panel and any module tags contained in a template. ...


7

Most serious modules I know of create their own settings table. It's not ideal, but EE doesn't really offer any built in solutions for modules. If your module has an extension, as Tom mentioned, you can use that to store a serialized array of settings. Alternatively, I know some modules add a settings column to the exp_modules table (obviously after ...


6

I think you're looking for this page in the EE Developer docs. Basically, if you only need the JS in the Control Panel (so not on the front-end of the site), put your JS files in the /your_addon_package/javascript/ folder and then use $this->EE->cp->load_package_js('my_file'); to load it. If you need the JS outside of the CP as well, you need to ...


6

When you pass an array of data on to a view file, the keys become the variable names in that view file. So... $data = array( 'foo' => 'bar', 'lorem' => 'ipsum' ); return $this->EE->load->view('my_file', $data, TRUE); ...will mean that in the my_file view file you can then use the variables $foo and $lorem. In your case, that would ...


6

I worked through this with Justin and wanted to post this so others can use it. Basically I have a mod file with a custom function that logs when an image is downloaded. My variables are all logged after being set up. Here's the variables: $my_download = array(); $my_download["size"] = $image_size; $my_download["entry_id"] = $entry_id; $...


6

$mod_data['module_name'] should be class name of your actual module file (mod.photo_pdf.php), in your case 'Photo_pdf'


6

This is a bit of an undocumented feature, but it works like this. In your extension, add a class variable called $required_by, with an array of values: $required_by = array('module'); ('module' is actually the only acceptable array value here, as neither plugins nor accessories have installation routines, which are needed for this to work.) Note that ...


5

To get a single value, you want to use the row() method on your $query object: $this->EE->db->select('my_col'); $query = $this->EE->db->get_where( 'fb_photo_settings', array('setting_name' => 'facebook_id') ); $var = $query->row('my_col'); To get an object with a whole row: $query = $this->EE->db->get_where( '...


5

The methods you want to use in order to have a tag pair is: //To loop over multiple items with variables //inside each (eg: looping through entries $this->EE->TMPL->parse_variables($template, $data); //To show a single item with multiple variables within it $this->EE->TMPL->parse_variables_row($template, $data); Most of the time you ...


5

Solspace's Freeform has a dynamic recipients functionality that just might serve your needs. I quote: recipients="yes" This parameter allows you to let your users select recipient email addresses dynamically within the form itself. So for example, you can have a dropdown select menu that allows your users to select the destination for their email (...


5

EE's contact form does not support custom fields per se (i.e., it doesn't support the custom fields you'd use for your channels), but you can have multiple fields populate the message by naming each with an array syntax: <label for="message">Your Message</label> <textarea name="message[]" id="message"></textarea> <label for="how"&...


5

You can use $this->EE->output->send_ajax_response($array); for the same purpose.


5

Good on you for writing your first plugin. Use this as a starting point for your plugins, quick, easy and avoids missing something. pkg.io Create it, download, unzip and upload to third party folder, just like any other add on. Once you can 'see' it in the plugin/module list you're all set to add your code.


5

First, no need to ever load directly from CI - you can always use EE. (So, $this->EE->load->helper('file').) Same with your validation class - I'd extend Form_validation, not CI_Form_validation. (Generally, EE should serve as your path to anything CI-related to avoid any conflicts.) You'll need to load your custom validation library, and call it ...


4

Neither Active Record nor DB Forge have a “SHOW TABLES” function. You’d have to just do it with query(): if ($EE->db->query('SHOW TABLES LIKE `exp_mytable`')->num_rows())


4

Your example code shows you doing two things: Listing any existing comments on the entry ({exp:comment:entries}) Displaying a list of Channel Entries ({exp:channel:entries}) Nowhere are you displaying the comment form (even though you linked to the documentation on it). However, the comment form is generally meant to be used on a "single entry" template, ...


4

Yes via ACTion URLs, tutorial here. Basically in your install method (in your upd. file): //### Create ACTion IDs for the relevant functions ### $formActions = array( "YOUR-METHOD-NAME" ); foreach ($formActions as $method) { $data = array( 'class' => $this->class, 'method' => $method ...


4

The session cache only lasts for a single page request. So by the time your action gets called, that cache is gone. You'd be better off adding those to the form as hidden fields, and then grabbing them from POST in your action.


4

The issue is parse order. Read the attached pdf.parse order. Turn on the debugger and then view the template in your browser. Scroll down thru the debugger until you find the tag containing {current_url}. You will see that that {current_url} has not been parsed. According to the attached doc, it is not parsed until step 9 - last. In your module, try $...


4

This is far from obvious how to achieve in EE, and it's not really documented at all. A long while ago I wrote up on Stack Overflow how we (used to) do this in Store, and this was in turn based on how SafeCracker (now Channel Form) did it. However, I've since figured out an even cleaner way to achieve it (Channel Form, FreeMember, and many other add-ons use ...


4

I would suggest a couple things to help separate our your code. As Derek mentioned in a comment above, make sure you're abstracting your data model work to a model class. You can also create a libraries directory within your add-on package and begin to create your own set of libraries. Since they are local to your package, you'll be able to easily load them ...


4

If you add parse="inward" to your channel entries tag parameters, it will force module tags inside your parameters to be parsed before the channel entries tag.


4

Welcome to ExpressionEngine! The first thing to understand is that EE has no concept of "regions" - it completely separates your content from your templates. The only content which appears at any given URL (which essentially is the same as your templates - templates in EE are like routes or controllers) is what you explicitly define inside your templates. ...


4

I can think of two ways to do this. One is to use Resource Router. Your config would look something like this: $config['resource_router'] = array( ':num' => function($router, $wildcard) { $query = ee()->db->select('url_title') ->where('entry_id', $wildcard->value) ->where('channel_id', 1) // use the right channel id here ...


4

I found the answer. Devotee has a list here.


3

If you only have a few settings, the most common pattern for this is to use a companion extension for your module, as extensions get a built-in settings screen for "free", avoiding the need for a separate table. As Adrian says though, the native extension settings are stored as a serialised array, so if you have a large amount of settings data a separate ...


3

If you upgrade to the current version, 2.5.5, it is bundled within the install.


3

Something like that is not possible with the first party search module. It would be possible to build queries like that with Low Search or Solspace SuperSearch however.


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