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

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

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

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

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

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

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

A few things that should help you out. 1) You should be using the EE instance. Normally you to the get_instance() in the constructor of your module and make it available as a class variable. 2) The do_upload method accepts a string with the name of the file upload field, not the value of the posted field. Your code should look somehting like this // ...


2

The EE1 docs are still available for download. Just look in the top right corner for a link to download the zipped docs. You can look for the section about the email module, which should do exactly as you need. In this case, it may be easiest to just work with what you have. Upgrading to 2.7 from 1.6.8 could be quite an undertaking. Sometimes it works out ...


2

Structure is the only self-contained solution to have a completely automated, whole-site navigation for every Pages URI that is automatically kept up to date as the end user adds new pages or changes the overall Pages URI hierarchy. But Structure is more of a whole-hog commitment to how you set up and build your site (some like this, others do not). In other ...


2

If you look at the Template Parsing Order, you'll see that the redirect, stage 20, is parsed after the modules, stage 15. So, let's try to prevent the parsing of exp:channel:entries. I thought you could try this: {if logged_out}{redirect="member/login"}{/if} {if logged_in} {exp:channel:entries require_entry="yes" parse="inward"} {addon_github} ...


2

No, there isn't any hook for it. You might see this question/answer Track logged-in user events which seems much similar to your need.


2

The issue was with my a specific line of code in my upd.database_add.php file. The original line was 'ACT' => ee()->functions->fetch_action_id('Module_name', 'register'), It should be (and currently is corrected to) 'ACT' => ee()->functions->fetch_action_id('Database_add', 'register'), I forgot to put the name of my module as an ...


2

If it's just for a slider on the front-end, forget that you're even using EE and include jQuery as you would with any other platform. HTML5 Boilerplate recommends using the Google CDN with a local fallback, so you could throw this segment in your template: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <...


2

If you wanted to use Template Routes, here's how you'd do it: $config['template_routes'] = array( 'about-us' => 'template_group/about-us', 'faq' => 'template_group/faq', ); This will make it so if you visit the http://yoursite.com/about-us url, you'll get the template_group/about-us template.


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