Hot answers tagged

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

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

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

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

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

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

Man, take a look at the function _parse_sub_template used on stash. Mark Croxton, the developer of stash, cloned the tagdata and parsed it. // clone the template object $TMPL2 = $this->EE->TMPL; unset($this->EE->TMPL); // parse variables $TMPL2->tagdata = $this->_parse_template_vars($TMPL2->tagdata); // parse simple conditionals $...


3

The code you have should work fine. I've just run a test on a module and it loads fine in EE v2.5.3 (either in a method or in the class constructor). I've just had a quick read of the EE changelog and can't see any reference to changes there, so don't think it's version related. Are you sure it's not calling the Class and then doing something unexpected? I ...


3

You can't do that from the Pages module. You can set the default template, and then, in that template, call a specific entry by entry_id. This is an example of what I typically do in the default template (site home page)--e.g., site/index: {exp:channel:entries entry_id="1" channel="home_page" disable="member_data|trackbacks|pagination|...


3

Since Last Visit "Attempts to point out various actions that have happened since a visitor's last visit to your site." http://devot-ee.com/add-ons/since-last-visit Otherwise you'd need to roll your own plugin that taps into the Session Class: http://ellislab.com/expressionengine/user-guide/development/usage/session.html Specifically looking at this ...


3

Generally when this happens it’s because either your system is off, or your .htaccess file intercepting Assets’ Ajax requests. If it’s the latter, you can try adding this to system/expressionengine/config/config.php: $config['assets_site_url'] = "/index.php"; Assuming you don’t have a .htaccess redirect that forces “index.php” out of the URL, that should ...


3

You can do it with the following example code within your plugin: require_once PATH_THIRD."modulename/modulefilename"; $obj = new ModuleClass(); $obj->module_method(); Hope, it would help you.


3

I'm using PHPUnit, which is by far more popular in PHP-land. The full ins and outs of getting it set up are probably beyond a stack exchange answer, but assuming there are a couple things which should put you in the right direction. Testing with EE and CI in general is always an uphill battle, since they weren't really designed with testing in mind, and ...


3

You're using the wrong hook. Try using entry_submission_start and/or publish_form_entry_data Update: Abort the channel entry publish process? Head-scratcher: manipulating new/updated entries after submission


3

Looking carefully at your error message, you may have some incorrect capitalization of the EE_Fieldtype class file name. EE_Fieldtype.php is the correct way (uppercase F, lowercase t). Likely your localhost is case insensitive but your server is not.


3

I've very little experience with Drupal since 4.x many years ago, tried to get into it at 6.x and 7.x the last being 2 years ago. Ultimately went with ExpressionEngine 2 (had 1.6.x experience in the past for this). That said here are some thoughts. Templates - these can be flat files, you can use the administrative control panel to sync between the ...


3

You should create a library, which is just a PHP class stored in system/expressionengine/third_party/your_addon_name/libraries/. <?php class Your_library { public function do_something() { return 'foo'; } } Then in your module / extension, you'd be able to do this: ee()->load->library('your_library'); // prints out foo echo ee()->...


3

Extensions are used when you want to take over, modify, or perform extra routines when native first-party methods are executed. For example, performing extra actions after an entry is saved. Modules (and Plugins to an extent) are used when you want to make functionality (and therefore output) available in Templates via tags. Things that need to occur in a ...


3

You should be able to do: {exp:channel:entries} {if page_uri} {!-- or {if pages_url} --} This is a page in the pages module {if:else} This is not {/if} {/exp:channel:entries}


3

Crelate a plugin containing single function, say, function_name. The plugin will accept member_id of logged in visitor ee()->session->userdata('member_id') and ID of entry being viewed, passed as parameter ee()->TMPL->fetch_param('entry_id) In this function, if member_id is not 0 (i.e. member is logged in), perform a check against your ...


3

The 1st party guide is everything you need to get the concept of module/extension/add-on/plugin/fieldtype development : https://ellislab.com/expressionengine/user-guide/development/index.html If you're looking to hook into existing events refer to the list of hooks availabel and create an extension : https://ellislab.com/expressionengine/user-guide/...


3

It's really your choice here. I imagine that this framework is best for smaller addons. One point of access is always slightly frowned upon; because it creates a SPOF in your addon. Trust me, I totally get the code-install-test-uninstall-ad.nauseam development path of EE modules, I'm sick of it too. However, I've found, that paying more careful attention ...


3

As error says, PHP 7 is only allow variables to passed by reference not an instance. You now need to remove that line and replace all $this->EE calls to ee(). That will work for you.


2

You'll need to use the themes folder to use assets like images. So use a file structure like this: /system/expressionengine/system/third_party/my_addon/[your-addon-files] /system/expressionengine/system/third_party/my_addon/views/[your-addon-view-files] /themes/third_party/my_addon/css/[css-files] /themes/third_party/my_addon/images/[your-images] /themes/...


2

Alas you don't mention where you get $config from. I've assumed it's a global class variable below. public function outputBrowser($results) { $data = array( "results" => $results, "config" => $this->config ); $this->EE->load->add_package_path($this->report_path); return $this->EE->load->view('...


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