# Question
Title: Pull dynamic entries using Ajax template on multiple Structure entries with Relationships
I've created two separate Structure entries, both using the Page template below with Relationship entries. It works fine if I only want one page, but I've made a second page to pull different Relationship entries for each page, but now it's just pulling the same relationship entries for both pages. I tried using `entry_id="{entry_id}` in the `{exp:channel:entries}` on the `recipe_ajax/index` template and that didn't work...only works when I explicitly write the id.

Is there another way to parse the ajax template so that I can use the dynamic `entry_id="{entry_id}` to pull correct entries? Or am I missing something completely obvious?

Here's my Page template:

```
{embed="layouts/index"}

{!-- PAGE CONTENT --}
{exp:stash:set parse_tags="yes"}

    {exp:channel:entries cache="no" refresh="60" disable="category_fields|member_data|pagination"}

        {stash:content}

            <div class="recipes-section add">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="article-holder row" id="container">
                                {recipes_landing_recipes limit="15"}
                                    <div class="grid-item article col-xs-12 col-sm-4 col-md-3 all {recipes_landing_recipes:categories}{exp:streeng slug='yes'}{category_name} {/exp:streeng} {/recipes_landing_recipes:categories}">
                                        <a href="{route='recipes/recipe_detail' title='{recipes_landing_recipes:url_title}'}">
                                            <div class="img-holder">
                                                <img src="{if recipes_landing_recipes:recipe_featured_image}{recipes_landing_recipes:recipe_featured_image}{if:else}/assets/images/bsl-placeholder.jpg{/if}
                                                " height="366" width="342" alt="{recipes_landing_recipes:title}">
                                            </div>
                                            <strong class="title">{recipes_landing_recipes:title}</strong>
                                        </a>
                                    </div>
                                {/recipes_landing_recipes}
                            </div>
                            <a class="btn btn-danger btn-load" href="{path='recipe_ajax/index'}" style="display: none;">view more</a>
                        </div>
                    </div>
                </div>
            </div>

        {/stash:content}

    {/exp:channel:entries}

{/exp:stash:set}

```

And here's the `recipe_ajax/index` template:

```
{exp:channel:entries channel="recipes_landing" cache="no" refresh="60" disable="categories|category_fields|member_data|pagination}
    <div class="post-section">
        {recipes_landing_recipes offset="15"}
            <div class="grid-item article col-xs-12 col-sm-4 col-md-3 all {recipes_landing_recipes:categories}{exp:streeng slug='yes'}{category_name} {/exp:streeng} {/recipes_landing_recipes:categories}">
                <a href="{route='recipes/recipe_detail' title='{recipes_landing_recipes:url_title}'}">
                    <div class="img-holder">
                        <img src="{if recipes_landing_recipes:recipe_featured_image}{recipes_landing_recipes:recipe_featured_image}{if:else}/assets/images/bsl-placeholder.jpg{/if}" height="366" width="342" alt="{recipes_landing_recipes:title}">
                    </div>
                    <strong class="title">{recipes_landing_recipes:title} {recipes_landing_recipes:entry_id}</strong>
                </a>
            </div>
        {/recipes_landing_recipes}
    </div>
{/exp:channel:entries}

```

**UPDATED ANSWER:**

I was able to resolve by calling the entry\_id\_path in the Page template `{entry_id_path='recipe_ajax/index'}` and referencing this path in the ajax file like so `entry_id_path="{entry_id_path}`

# Answer
> 0 votes
Not sure what you are actually trying to do.

If I understand it all, it seems your link is emulating a pagination link - so the link will open a view of the next block of results from `{recipes_landing_recipes}` results. If so, perhaps you could just make use of EE's pagination features to do this. Would be less complicated I think.

I think you are complicating this by using `{stash}` but since you are, you could perhaps just dump out all the recipes into stash once and then pull them from there when you need them.

HTH

---
Tags: templates, structure, ajax, embeds, parse
---


title: Post-Ugrade Problem with 3.3.1

text:
# Question
Title: Post-Ugrade Problem with 3.3.1
Fatal error: Call to a member function getId() on null in ~/system/ee/legacy/libraries/Session.php on line 398

The $member object (re: $member = ee('Model')-\>get('Member', $member\_id)-\>first();) is null.

What's going on?

# Answer
> 2 votes
I just ran into this same issue and after a good few hours of debugging, I found the issue was because the member didn't have an entry in the **exp\_member\_data** table.

Just add a new row to the **exp\_member\_data** table with the member\_id you're logging in with (*search the exp\_members table to find the correct member\_id if need be*) and you should be all set.

You don't need to enter any other information in the row to resolve the issue.

---
Tags: php
---


title: Tracking tool for entries in EE3

text:
# Question
Title: Tracking tool for entries in EE3
i'm working on a project (EE3) and i need to have a TOP-10 section which is the most read (articles) entries. I had Solspace Tracker on my mind but i saw they will not upgrade it to EE3.

Does anyone know any other add-on or tool or some alternative method to track each entry and then to show the 10 most read entries?

Thank you for your time

# Answer
> 0 votes
It has some limitations, but there is the channel entries `track_views` parameter. More info in EE3 docs.

---
Tags: solspace, ee3, tracking, solspace-tracker
---


title: EE3 Relationships VS Playa

text:
# Question
Title: EE3 Relationships VS Playa
I know the EE3 Relationship fieldtype is now more powerful.

Does Playa 5 for EE3 still have advantages compared to the new EE3 Relationships?

Is Playa 5 worth it?

# Answer
I haven't used the latest Playa but the with relationships being native it will stop painful upgrades to the CMS whenever you next upgrade - it's almost always better to rely on core modules then to introduce 3rd party modules.

Also, if you want to switch to relationships then follow this simple guide: How to move all Playa relationship to EE relationships
> 2 votes

---
Tags: playa, relationships
---


title: JSON_Encode add-on

text:
# Question
Title: JSON_Encode add-on
Is there an add-on for JSON\_Encode for EE3?

We used one before in our previous EE2.5 version to convert EE channel entries for our mobile site.

# Answer
> 0 votes
I don't know if this will meet your needs, but the EE2-compatible JSON plugin by rsanchez may work with EE3 using the manual update described at https://github.com/rsanchez/json/issues/58. The person who suggested the change says it worked for them.

**Edit:** FWIW I did as the instructions laid out and was able to output a channel's data in JSON format using EE 3.5.4.

---
Tags: json, encode
---


# Question
Title: Tagger 4.0 and EE 3.4.1 - Can't add tags?
I've added Tagger 4.0 to my system, I've added the tag field to my channel fields and as per the instructions, it says to type a tag and hit enter to save it... Problem is that hitting enter to save the tag submits the form.

How can I get around this?

# Answer
I've had issues with Tagger too - I've experienced this exact same issue too and making sure EE was up to date and re-downloading the latest version of tagger completely removing and reinstalling seemed to fix it for me, but I appreciate that's not helpful if you already have entries with tag data.

Is that something you can try?
> 0 votes

---
Tags: ee3, tags, devdemon-tagger, tagger
---


# Question
Title: "File not found" error when clicking on stories
I'm working on reviving (and upgrading the EE 3)n a site that has been moribund (no posting) for about 18 months. The home page index displays OK, but if I click on any story or try to view the next page of the index, I get a blank page with the message "File not found."

I don't know when the site stopped working. It's running EE version 2.10.1. The back end and control panel seem to work fine.

The site is at http://coastsider.com

Any idea what might be going on here?

# Answer
I found the answer. In the .htaccess file, I'm rewriting URL's to remove the index.php file. When my sysadmin updated Apache, I needed to change:

```
 RewriteRule ^(.*)$ index.php/$1 [L]

```

to

```
 RewriteRule ^(.*)$ index.php?/$1 [L]

```

That information is in the .htaccess file comments as well. I hope that save someone else some time.
> 4 votes

---
Tags: ee2
---


# Question
Title: can the "Entry Manager" in EE 3.4.6 do more than "remove"
In EE 2 we were able to bulk-edit several articles at once -- mostly to change their status, the time/date of publication, and the wording of the headline. But in EE 3.5.6, there seems to be **less** capability. We can only **remove**. Is there any way around this, or do we have to buy an add-on? The "check -- with selected --" does not seem to make sense....

# Answer
EE2 has edit option to change status and entry date of entries. unfortunately EE3 doesn't have anything like that till now. Let's hope they will add this in there future updates
> 0 votes

---
Tags: bulk
---


# Question
Title: I get an ERROR when installing CALENDAR 2.3.0
Below is the Error Code

Exception Caught SQLSTATE\[42000\]: Syntax error or access violation: 1072 Key column 'ics\_url' doesn't exist in table: CREATE TABLE IF NOT EXISTS `exp_calendar_calendars` ( `id` INT(10) UNSIGNED NOT NULL AUTO\_INCREMENT, `site_id` INT(10) UNSIGNED DEFAULT NULL, `name` VARCHAR(100) NOT NULL, `url_title` VARCHAR(100) NOT NULL, `color` VARCHAR(7) DEFAULT NULL, `description` VARCHAR(300) DEFAULT NULL, `ics_hash` VARCHAR(100) DEFAULT NULL, `default` TINYINT(1) DEFAULT '0', PRIMARY KEY (`id`), KEY `site_id` (`site_id`), KEY `ics_url` (`ics_url`) ) DEFAULT CHARACTER SET utf8 COLLATE utf8\_unicode\_ci ENGINE=InnoDB; ee/legacy/database/drivers/mysqli/mysqli\_connection.php:122

# Answer
There was a bug with Calendar 2.3.0. We've since released Calendar 2.3.1, which resolves this issue. Sorry for the inconvenience.
> 0 votes

---
Tags: solspace, solspace-calendar
---


# Question
Title: adding container tags or tracking pixels
How do i add container tags or tracking pixels? I need to add code provided by third party digital media company so I can track conversions. How is this done on EE?

# Answer
> 0 votes
Add it your template (s) that you use to display content.

Here's some info from the official docs

---
Tags: tracking, analytics
---


title: Decrypt Password as string

text:
# Question
Title: Decrypt Password as string
We are using ExpressionEngine **v2.10.1**, we are going to import data from the database. We have created API that returns data as JOSN by using:

```
{exp:query sql="SELECT * FROM exp_member_data"}

```

But we also need the used password as a string so we can encrypt it according to our own way. **Is there any way to get the password as a string?**

# Answer
> 0 votes
Password is highly confidential thing for website. It is important to save the password in any non decrypt algorithm so if someone attack on site and steal all the information, they cannot use the passwords.

ExpressionEngine do similar thing by encrypt password with md5 or SHA algorithm that is not possible to decrypt.

So, the answer of your question is: **It is not possible to get password as a String**

---
Tags: database, mysql, password, super-admin
---


# Question
Title: Trouble with Template Route & Pagination
I have created a template route for the typical blog scenario where I have an index template in a "blog" template group that lists blog posts along with a detail template that shows full blog posts.

I have my template route set up like so:

It works fine except for the pagination on the index page. I get 404 errors with pagination.

I have tried adding /{pagination} & /{pagination:pagination} to the end of the route along with trying to add /blog/{pagination} & /blog/{pagination:pagination} as a route for the index template but nothing works.

Any help on getting pagination to work with this is much appreciated.

Using EE v3.5.6.

# Answer
> 0 votes
What you need to do is add `{page:pagination}` to the end of the route. So something like:

```
/blog/{story:alpha_dash}/{page:pagination}

```

HTH

---
Tags: pagination, template-routes
---


title: How to make templates output JSON?

text:
# Question
Title: How to make templates output JSON?
I am trying to use EE templates the same way I use CI controllers. Normally, when I need an "API" wherein my JS can call a URL (maybe with some POST variables) and get a JSON (or JSONP) response back, I'll just put these API methods in a CI controller and make sure I set the content type before returning a response.

There doesn't seem to be a JSON template type. So, I've installed this http://devot-ee.com/add-ons/http-header and set the content type using the add on.

Is there a native way to do this in EE? Or was I right to use the add on?

# Answer
> 15 votes
There isn't a native way to do JSON output in EE for channel data (AFAIK).

Have you seen Rob Sanchez's JSON plugin? You just pass params as you would with `{exp:channel:entries}`.

You can specify which fields to output, optionally set it to only output if an `xhr` is detected, and it will output member data too. You can then wrap the rest of your template in an ajax detect conditional (I use Mo'Variables for this) and you've got a single template that serves either `HTML` or `JSON` depending on the request type, no controller required.

That might just do the trick in one hit, or at least provide a solid basis for custom development. At the very least you want to avoid formatting `JSON` by hand - it's way too pernickity to be any fun.

# Answer
> 10 votes
I have recently used EE templates to make JSON output from channels that contain a range of custom fields, including P&T’s Playa, Matrix and Wygwam fieldtypes. Those that are not familiar with JSON might find this useful. While it is a bit fiddly, all that is really required is a resource who is familiar with the JSON syntax/format to help you craft the template properly.

## Add-ons

Low\_Replace This add-on is used to find and replace entities that need to be either stripped or changed in your resulting data to validate as proper JSON. For example: double quotes, line breaks, or tabs.

HTTP\_Header This add-on is used to set the proper content type in your http header to JSON. Place this tag at the top of your template: {exp:http\_header content\_type="application/json"}

## Links

JSON Validator, Formatting EE Entries as JSON

## End of Line Syntax

Dealing with end of line syntax (comma or no comma), is the biggest challenge I came across. I used the backspace param on the main channel entry tag and conditional tags when building arrays (matrix or playa fields).

### Matrix Example

```
{if balloons != ""},
    "Balloons": [
    {balloons}{
        "colour": "{colour}",
        "size": "{size}"
    }{if row_count != total_rows},{/if}
    {/balloons}
    ]
{/if}

```

### Playa Example

```
{if blocks != ""},
    "Blocks": [
    {blocks}{
        "colour": "{colour}",
        "size": "{size}"
    }{if {exp:playa:total_children field="blocks"} != "{count}"},{/if}
    {/blocks}
    ]
{/if}

```

I put the previous line’s end-of-line comma at the beginning of the next conditional. That way, if balloons or blocks is empty and nothing prints, then the previous line will be the last line and there should be no comma. To deal with the same issue within the matrix or playa arrays, I use row\_count, count, and total:children variables to figure out if a line is not the last line and should thus have a comma.

## Remove/Replace Entities

I use the Low Replace tags to escape double quotes, replace line breaks and remove tabs like thus:

```
{exp:low_replace multiple="yes" regex="yes" find="QUOTE|NEWLINE|/\t/" replace="\QUOTE|SPACE|"}
    {body}
{/exp:low_replace}

```

This works nicely when using a P&T Wygwam field that may have odd things in them. You can use regex here, so look into that when needed.

Tips Watch for extra spaces when using the backspace param. Your closing channel entry tag needs to immediately following the last comma like thus:

```
{exp:channel:entries channel="ch_member_profiles" backspace="1"}
    …
},{/exp:channel:entries}
]

```

# Answer
> 5 votes
You could set the template type to javascript and do something like this:

```
{exp:channel:entries
    channel="locations"
    limit="5"
}
{
    "Store": "{title}",
    "Address": "{address}",
    "City": "{city}",
    "State": "{state}",
    "Zip": "{zip}",
    "Phone": "{phone}",
},
{/exp:channel:entries}

```

# Answer
> 4 votes
Did you guys have a look at Chris Imrie's data api add-on on github. Still alpha but interesting nonetheless.

# Answer
> 3 votes
IMHO, you really don't want to use templates as controllers; consider them as views instead. You sound like you know about PHP so, if I were you, I'd write an extension with one of the template hooks instead.

# Answer
> 3 votes
Nope, there's no native EE method of outputting a template as JSON. The HTTP Header plugin is exactly what you need. Just format your template in JSON and you're good to go.

# Answer
> 2 votes
I haven't used the plugins mentioned here, but you can use PHP in your template (on output) and do this by mixing the templating language and PHP. Not the cleanest, but it works:

```
<?php
header("Content-Type:application/json");
$events = array();
?>
{exp:channel:entries channel="events"}
<?php
$a = array('id' => {entry_id}, 'title' => '{title}');
array_push($events, $a);
?>
{/exp:channel:entries}
<?php
echo(json_encode($events));
?>

```

You'd probably want to encode the output from your entries - the above example would break if there was an apostrophe in the title.

# Answer
> 1 votes
You might be able to in a default template if you place curly brackets on their own lines, like so:

```
{
  "success": 1,
  "errors": [],
  "count": 15
}

```

# Answer
> 0 votes
simple grid example (without comma in the last iteration):

`{exp:channel:entries channel="demo" url_title="entry1" status="open" disable="categories|member_data|category_fields|pagination" dynamic="no"}
[
{grid_field orderby="random"}`

````
{

    "id": "id{grid_field:count}",

    "title": "{grid_field:title}"

}{if gridfield:count < gridfield:total_rows},{/if}

````

`{/gridfield}
]
{/exp:channel:entries}`

# Answer
> 0 votes
I was modifying my locations json file this morning, so I thought I would weigh in. I'm using the JSON Encode add-on inside of a low\_search results. Of course, the Low Search results could be switched with Channel Entries or any other tag which gets your data.

This is my **full** json\_locations.html template:

```
{exp:http_header content_type="application/json"}
{"locations": [

{exp:low_search:results
    channel="locations"
    limit="1000"
    dynamic="no"
    distance:to="locations_latitude|locations_longititude"
    distance:unit="mi"
    require_all="category"
}

    {
        "id": "{entry_id}",
        "url_title": "{url_title}",
        "type": "{categories show_group="6" backspace="1"}{category_id}|{/categories}",
        "region": "{categories show_group="7" backspace="1"}{category_id}|{/categories}",
        "name": {exp:json_encode}{locations_displayed_name}{/exp:json_encode},
        "address": {exp:json_encode}{locations_address_1}{/exp:json_encode},
        "city": {exp:json_encode}{locations_city}{/exp:json_encode},
        "state": {exp:json_encode}{locations_state}{/exp:json_encode},
        "zip": {exp:json_encode}{locations_zip}{/exp:json_encode},
        "phone": {exp:json_encode}{locations_primary_phone_number}{/exp:json_encode},
        "geo_lat": {exp:json_encode}{locations_latitude}{/exp:json_encode},
        "geo_lng": {exp:json_encode}{locations_longititude}{/exp:json_encode},
        "additional_data": {exp:json_encode}{categories show_group="6"}<i class='fa fa-map-marker {category_url_title}'></i> {exp:ce_str:ing ucwords}{category_name}{/exp:ce_str:ing}<br> {/categories}{/exp:json_encode}
    }{if count<absolute_results}, {/if}

{/exp:low_search:results}

]}

```

I'm calling this from Javascript to render map locations on a Google Map. This is the line from JS:

```
var location_json = "/locations/json_locations";

```

This is what it would look like if you used exp:channel:data:

```
{exp:http_header content_type="application/json"}
{"locations": [

{exp:channel:entries
    channel="locations"
    limit="2"
    dynamic="no"
}

    {
        "id": "{entry_id}",
        "url_title": "{url_title}",
        "type": "{categories show_group="6" backspace="1"}{category_id}|{/categories}",
        "region": "{categories show_group="7" backspace="1"}{category_id}|{/categories}",
        "name": {exp:json_encode}{locations_displayed_name}{/exp:json_encode},
        "address": {exp:json_encode}{locations_address_1}{/exp:json_encode},
        "city": {exp:json_encode}{locations_city}{/exp:json_encode},
        "state": {exp:json_encode}{locations_state}{/exp:json_encode},
        "zip": {exp:json_encode}{locations_zip}{/exp:json_encode},
        "phone": {exp:json_encode}{locations_primary_phone_number}{/exp:json_encode},
        "geo_lat": {exp:json_encode}{locations_latitude}{/exp:json_encode},
        "geo_lng": {exp:json_encode}{locations_longititude}{/exp:json_encode},
        "additional_data": {exp:json_encode}{categories show_group="6"}<i class='fa fa-map-marker {category_url_title}'></i> {exp:ce_str:ing ucwords}{category_name}{/exp:ce_str:ing}<br> {/categories}{/exp:json_encode}
    }{if count<absolute_results}, {/if}

{/exp:channel:entries}

]}

```

Then point your browser to http://yourwebsite.com/locations/locations\_json to see the results. You should see this:

```
{"locations": [

{
        "id": "10477",
        "url_title": "my-url-1",
        "type": "343",
        "region": "51",
        "name": "Caf\u00e9 Degas",
        "address": "2020 Smith Ave",
        "city": "New Orleans",
        "state": "LA",
        "zip": "70119",
        "phone": "504-777-5635",
        "geo_lat": "29.98032300",
        "geo_lng": "-90.08639902",
        "additional_data": "<i class='fa fa-map-marker'><\/i> My Location 1<br> "
    },{
        "id": "10233",
        "url_title": "my-location-2",
        "type": "48",
        "region": "51|173|57",
        "name": "My Location 2 \u2013 Bloomfield",
        "address": "4500 Archer Pkwy., 1st Floor",
        "city": "Metairie ",
        "state": "LA",
        "zip": "70004",
        "phone": "504-555-8563",
        "geo_lat": "30.017772",
        "geo_lng": "-90.1880092",
        "additional_data": "<i class='fa fa-map-marker'><\/i> My Location 2<br> "
    }

]}

```

# Answer
> 0 votes
I am using the {exp:http\_header content\_type="application/json"} but now I get the error when validating:

Invalid encoding, expecting UTF-8, UTF-16 or UTF-32.

any advice?

---
Tags: add-on, templates
---


# Question
Title: How to resolve-call_user_func_array() expects parameter 1 to be a valid callback, class 'Structure_ext' does not have a method 'sessions_end'?
A PHP Error was encountered

Severity: Warning

Message: call\_user\_func\_array() expects parameter 1 to be a valid callback, class 'Structure\_ext' does not have a method 'sessions\_end'

Filename: libraries/Extensions.php

Line Number: 265

# Answer
> 0 votes
**Question** A PHP Error was encountered

Severity: Warning

Message: call\_user\_func\_array() expects parameter 1 to be a valid callback, class 'Structure\_ext' does not have a method 'sessions\_end'

Filename: libraries/Extensions.php

Line Number: 265

EE version2.5.5 structure 3.3.9. When I upgraded structure to 4.1.12 i got the error A PHP Error was encountered Severity: Notice Message: Undefined property: EE::$cache Filename: helpers/eeharbor\_ee2\_helper.php Line Number: 229 Fatal error: Call to a member function get() on null in C:\xampp\htdocs\intranet-backup\system\expressionengine\third\_party\structure\helpers\eeharbor\_ee2\_helper.php on line 229. Then I removed 4.1.12 folder and stored 3.3.9 back up,then i got the error Message: call\_user\_func\_array() expects parameter 1 to be a valid callback

Answer

I think downgrade the version must have done something wired. Can you do uninstall the module and install it again.. also, structure save the pages in exp\_sites table in base64 format protected by serialize of an array. you should remove all the entries related with structure manually. it is very hard task to do as it can stop your site if you do anything wrong in DB – Mufi 18 hours ago 1
Thanks error solved .I installed it again. – Shiny Muhammed 9 mins ago

Accepted

# Answer
> 0 votes
I think downgrade the version must have done something wired.

Please try uninstall the module and install it again.

Note: Structure save the pages in exp\_sites table in base64 format protected by serialize of an array. you should remove all the entries related with structure manually. it is very hard task to do as it can stop your site if you do anything wrong

---
Tags: php-errors
---


# Question
Title: Solution to PHP error Undefined property: EE::$cache
We are now preparing to upgrade to Expression Engine 3.5.4 from EE version 2.5.5.

We are implementing up-gradation on local test server before implementing it on live server to make sure that we do not run into any issues.

Currently running structure Version 3.3.9 in EE 2.5.5 website is incompatible to EE version 3.5.4.

So we recently purchased structure version 4.1.12 from https://eeharbor.com/structure.

But when we are upgrading( as per the instruction from http://buildwithstructure.com/documentation/upgrading/) structure version 3.3.9 to 4.1.12 from EE2.5.5 website running in local test server shows the PHP Error.(Screenshot Attached).

Actually it is upgraded to 4.1.12 as per the screenshot1. But when click on module settings (screenshot2) shows this error and the same error occurred in the front end when we try to access the index.php.

SERVER DETAILS

Test Sever- XAMPP

Server API -Apache 2.0 Handler.

Apache Version - Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30

PHP Version 5.6.30

EE Version - 2.5.5

Current structure Version 3.3.9

Upgrading to structure Version 4.1.12

ERROR IN FRONT END - A PHP Error was encountered Severity: Notice Message: Undefined property: EE::$cache Filename: helpers/eeharbor\_ee2\_helper.php Line Number: 229

Fatal error: Call to a member function get() on null in C:\xampp\htdocs\intranet-backup\system\expressionengine\third\_party\structure\helpers\eeharbor\_ee2\_helper.php on line 229

ERROR IN BACK END-

A PHP Error was encountered Severity: Notice Message: Undefined property: Addons\_modules::$cache Filename: helpers/eeharbor\_ee2\_helper.php Line Number: 229

Fatal error: Call to a member function get() on null in C:\xampp\htdocs\intranet-backup\system\expressionengine\third\_party\structure\helpers\eeharbor\_ee2\_helper.php on line 229

Kindly send the solution as early as possible.

Thanks in advance.......

Shiny muhammed.

# Answer
> 0 votes
$config\['database'\]\['expressionengine'\]\['cache\_on'\] = FALSE - Not worked. solved the error by commenting two cases **case 'get':** and **case 'set':** in **public function cache($mode, $key = false, $data = false, $persistent = true)** of **helpers/eeharbor\_ee2\_helper.php(Comment line no. from 228 to 237)**.After that error removed,front end loaded correctly, checked all links and they r working properly.In back end got the module settings page of structure 4.1.12.

---
Tags: php-errors
---


title: Unable to change site multisite EE3

text:
# Question
Title: Unable to change site multisite EE3
I have a multisite in my project but when I go to the cp and try to switch sites, the page simply refreshes and stays on the default site. When I open incognito in Chrome, login and try this again is **does** work, but when I then switch back to the default site and try to switch to the sub site again it simply refreshes again and stays on the default site.

It seems like some kind of cookie problem. How do I fix this?

# Answer
> 1 votes
In your backend, under **Settings \> Security & Privacy** choose `CP session type` to **Session ID Only**

---
Tags: multi-site-manager, ee3, cookies
---


# Question
Title: how to display a row # when looping through 2 different custom fields
I'm trying to spit out a table with first column being the # of row basically. However my {count} keeps resetting for each field loop. I need my count to stay the same

I have a VM Chosen field that I first loop through to display rows of all players in that field. I use {count} and works fine. Then I loop through a grid field and list out all players from that but the {count} resets to 1 because it's a new loop. I have all this wrapped inside a channel entries tag with limit="1" to a specific entry\_id.

Can you create a variable and increment it in EE without a plugin? I've never used Stash but it sounds like that would be a solution?

# Answer
> 1 votes
yes.. Php was the way to go here in the template. I created a php variable set to 1 and then within each loop I just incremented it and spit out the php variable so it kept a 1-10 list and never reset

---
Tags: channel-entries, ee3, grid, vmg-chosen-member
---


# Question
Title: what happens if you delete a category in EE?
What happens when I delete a category? We have created far too many categories, in a hierarchical list. I want to reduce it from 100 to 15 by deleting the sub-categories. Will the article then default back to the parent category? Or will it be completely detached from any category?

# Answer
Lets make it simple.

Suppose I have a category named Blog and have sub-categories like Articles, news, magazines. My Tree will look like this:

* Blog
    + Articles
    + News
    + magazines

Now, If I assign any entry to "News" category. Later if I decide to remove "News" category, My entry will still relate to it's parent category **(In this case Blog)**

Deleting category will delete the category from `exp_categories` and `exp_category_field_data`
> 0 votes

---
Tags: categories
---


# Question
Title: Listings disappear when item moved to submenu
I have 20 years experience developing LAMP apps, but I'm new to Expression Engine. I'm helping someone edit a site that was abandoned by the developer.

The site uses EE2 with the Structure module. They had a parent-level item that displayed listings. When I make it a sub-menu item to another parent-level item, the listings disappear. It says no listings found, even though I created a channel associated to that listing category.

Also, I see a lot of help being offered to use this or that code, but I can't tell where the template is that governs the layout of that page.

Can someone point me in the right direction to understanding this?

Thanks,

Bill

# Answer
> 0 votes
I figured it out.

I found the template and discovered that the developer was finding listings based on the url segment, which was now 2 instead of 1...

Bill

---
Tags: structure
---


title: Multiple installs

text:
# Question
Title: Multiple installs
Are multiple installs allowed. This is for a single project. I'm the President of the company and I need the install on my computer but I also need my web designer to have access. This is a single license for a single site. Is this ok?

# Answer
According to ExpressionEngine Licence it allows you to do copies for 2 purposes:

1. Making Copies

> You may make copies of the Software for back-up purposes, provided that you reproduce the Software in its original form and with all proprietary notices on the back-up copy.

2. ExpressionEngine Installations:

> An ExpressionEngine license purchase allows a single “live” installation in a production environment and ancillary “development use only” installations as needed to support the live installation (such as development and a staging servers).

That means you can create a single licence copy for your developer and designer to make development and/or edits on your site. so they can make changes, approved by person and then make same changes on LIVE without breaking live site.

I hope this can help.
> 2 votes

---
Tags: install
---


# Question
Title: DevDemon 4.0.0 Tagger tags not saving when publishing
I upgraded from EE2 to EE3. I had Devdemon tagger add-on, so I also had to upgrade it to the newest version (4.0.0) in order to be compatible with EE3.

The problem is that whenever I add a tag to an entry (new or existing) it doesn't get saved. When I hit Publish it seems like it is there, but when I go back to the entry the added tag isn't there. So in the front end there are no tags showing.

The entries added before I did the EE upgrade DO have their corresponding tags.

# Answer
> 2 votes
Make sure you enable the EE3 Caching Driver under Settings-\>Debugging & Output. That was my issue.

---
Tags: ee3, upgrade, devdemon-tagger
---


# Question
Title: How can I remove index.php from http://example.com/index.php/member/reset_password?&id=GHbFGYJM ? ExpressionEngine3
The link is sent to me in an email when I reset my password via front end login form and works as it should when I remove the index.php from the url. I have already created a rule in .htaccess to remove index.php from urls.

Here is my current .htaccess:

```
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Removes index.php from ExpressionEngine URLs
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{REQUEST_URI} !/system/.* [NC]
    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

     # Admin Access
    RewriteRule ^(admin)/?$ $1.php [L,NC]

    # Directs all EE web requests through the site index file
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]
    # RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

```

# Answer
> 0 votes
From your admin panel, Go to General configurations settings and set **Name of your site's index page** to **blank** or via FTP edit your config.php file inside config folder and add `$config['site_index'] = ""`

---
Tags: members, forgot-password, rewrite
---


# Question
Title: Generic error during install on DB config
I'm receiving the above error when attempting to install a new EE3 site. This is the first site we are attempting to stand up on a new WHM server running PHP7. Is there a mechanism to try and get a more detailed error message?

I have confirmed via MySQL Workbench that the settings are correct, but given the non-descript error, I'm somewhat at a loss for where to go next.

This is a brand new server so it's possible a PHP module is missing...

# Answer
> 1 votes
This ended up being simple. For my instance, the MySQL module wasn't installed for PHP. Once it was added it worked as expected... My issue ended up being the fact that the error was completely non-descript.

---
Tags: ee3, database, database-error, install
---


title: Cart Throb for Expression Engine 3.0

text:
# Question
Title: Cart Throb for Expression Engine 3.0
Really dumb question but maybe even dumber issue with Cart Throb.

When you receive this error.

```
Error

Aromatic Binder is currently out of stock.

```

Where in the heck and how the heck do you add more inventory when there isn't any specific inventory management in 3.0

# Answer
> 3 votes
From the CartThrob documentation.

> Decide whether or not you will manage inventory on an item-wide or based on a specific group of item-options. Select the inventory field in CT settings \> product settings \> product channels. Map your inventory field to the field that will be used to track inventory. If you haven't created an inventory field yet, just add a text field to your channel fields for your product channel.

https://www.cartthrob.com/docs/pages/application\_flow/#how-inventory-is-tracked

---
Tags: cartthrob, ee3
---


# Question
Title: New channel form hook, unable to get submitted data
I have just updated EE to 2.7.1 and see that Safecracker is now changed to Channel Form.

I have an extension which runs on submission end so have had to change the hook to the new hook for channel form.

The problem is, I am unable to get the submitted information as I did before.

Here is the top of my function, with the hook changed over.

```
public function channel_form_submit_entry_end($cf)
{
    $entry_id = $cf->entry['entry_id'];
    $member_id = $cf->entry['author_id'];

```

How do you now go about getting submitted information, as the following isnt working.

```
$cf->entry['entry_id'];

```

Thank you.

# Answer
> 3 votes
Try this inside your hook:

```
print_r($cf); exit();

```

This will let you inspect the structure of the object passed by the hook, and find where `entry_id` lives.

# Answer
> 1 votes
I am fairly new to EE, but did implement the same channel\_form\_submit\_entry\_end($channel\_form\_obj) hook. But I do not believe this hook passes any data to the function, just the channel form object. The other 2 channel form hooks do, however, appear to pass data via the $tagdata as noted in the docs. channel\_form\_entry\_form\_tagdata\_start($tagdata, $channel\_form\_obj), channel\_form\_entry\_form\_tagdata\_end($return\_tagdata, $channel\_form\_obj).

**Allow me add my own correction.**

I found a way to access the form entries using $\_POST in this answer.

function channel\_form\_submit\_entry\_start($form\_obj)

$data=$\_POST\['title'\];

// do something with $data now echo $data //change the data public function safecracker\_submit\_entry\_start()

{ $\_POST\['news\_body'\] = 'Test'; }

# Answer
> 0 votes
I'm late but i checked the post data using.. `ee()->input->post( 'YOUR-POST-VARIABLE', TRUE );`

But I'm using EE 3.x.x

---
Tags: safecracker, channel-form
---


title: Email notification from channel form

text:
# Question
Title: Email notification from channel form
I need to send an email notification to an specific address after channel form is submited.. The email address depend on the selection of a field in the form.. I know there's might be a hook for that but i don't know how to use it..

Thanks!

# Answer
> 1 votes
After many trial and error (as i'm not a real programmer).. i finally found something that works.. For all the newbies like me.. you need to have an addon.setup.php file and a ext.YOUR-THING.php as explain in the main doc https://docs.expressionengine.com/latest/development/addon\_setup\_php\_file.html and https://docs.expressionengine.com/latest/development/extensions.html.. Then my main script inside my extension file..

```
function channel_form_submit_entry_end( $cf ) {

    ee()->load->library( 'email' );

    $var = ee()->input->post( 'YOUR-POST-INPUT-NAME', TRUE );
    if ( $var == '123' ) {
        $recipient = 'email1@xyz.com';
    } else {
        $recipient = 'emai2@xyz.com';
    };

    ee()->load->library( 'email' );
    ee()->load->helper( 'text' );

    ee()->email->wordwrap = true;
    ee()->email->mailtype = 'text';
    ee()->email->from( 'email@xys.com' );
    ee()->email->to( $recipient );
    ee()->email->subject( 'YOUR SUBJECT' );
    ee()->email->message( entities_to_ascii( 'YOUR BODY MESSAGE' ) );
    ee()->email->Send();

}

```

I know it may not be the cleanest script by it works!.. If someone wish to clean this.. please feel free!

# Answer
> 0 votes
There is a hook. Find details here:

https://docs.expressionengine.com/latest/development/extension-hooks/module/channel-form.html#channel\_form\_submit\_entry\_endchannel\_form\_obj

All you have to do this is to create an extension file. Initialize email library. You can find fields data in 'parameter you passed in function' or in POST.

---
Tags: safecracker, notification
---


title: Preventing SQL Injections

text:
# Question
Title: Preventing SQL Injections
In a EE plugin if I construct a sql statement based on passed in parameters and use a EE-\>db-\>query($sql) call does the query function prevent SQL Injections or do I need to change my code to use some other query function to bind parameters?

# Answer
> 1 votes
You should always scrub any user input before it gets to your query.

The first thing you should do is run and input variables through the input class. i. e. `$var = ee()->input->post('my_var', TRUE)` this will run the XSS filter on the data.

Then when you use it in your sql: (this used to be a thing, but I can't find in the EE3 docs, they may of rolled it into the query or get function)

```
$var =ee()->db->escape_str($var)

```

---
Tags: database, sql, api
---


# Question
Title: How to remove a relationship field with php
I have a "Teams" channel that has a relationship field to a "tournaments" channel. On the frontend when I display all the teams for that tournament, I need to allow a user to remove their team from that tournament. How do I go about doing this? I still want to keep the team entry, just clear that relationship field so they aren't attached to a tournament anymore. Not sure if there are meta data and all that you have to set.

# Answer
You can use external entries plugin like as below:

```
{exp:external_entries:delete table="exp_relationships"
search:parent_id="{segment_1}" AND search:child_id="{segment_2}"  debug="no"}

```

Plugin is not available for `EE3` but it will still work in `EE3` just need to add the `addon.setup.php` file.
> 1 votes

---
Tags: relationships, ee3
---


title: Low search for multiple entries by ID?

text:
# Question
Title: Low search for multiple entries by ID?
I have a small real estate site and would like to be able to send clients a results shortcut containing specific entries. Is it possible to search for multiple entries by entry ID (eg. 54,230,34) with Low Search?

Thanks.

# Answer
> 1 votes
Yes. You can create a Low Search Shortcut by creating one in the CP, as described here. Then make sure you're setting the `entry_id` parameter to a pipe-separated list, eg. `54|230|34`.

If the order matters, use the `fixed_order` parameter instead.

Then, to display the results, set the `shortcut` parameter on the Results tag to the short name of the shortcut you created, as described here.

---
Tags: low-search
---


title: EE3 Channel Form with grid field

text:
# Question
Title: EE3 Channel Form with grid field
I'm trying to create fontend channel form page with a Grid field that has 3 columns. I've tried different variations but don't seem to get it working correctly. I have the css linked in my header

```
<link href="{path='css/_ee_channel_form_css'}" type="text/css" rel="stylesheet" media="screen">

```

The docs say to use

```
{field:my_field_name}

```

or if you are using {custom\_fields} it says to use {if grid} {display\_field} {/if}

But then it says "Manual construction of grid type fields is not supported. Most customization of grid fields can be done by overriding the CSS."

# Answer
I added jQuery's migrate file so I could still use latest jQuery 3x and that seemed to solve the problem when using {field:my\_field\_name}. My Grid shows up now with functionality. Some styling issues but seems to be working at least.

jquery-migrate-1.4.1.min
> 0 votes

---
Tags: safecracker, ee3, grid
---


title: Grid "no_results" not working?

text:
# Question
Title: Grid "no_results" not working?
**Am I using `no_results` properly?** Even when the grid doesn't have any data, I cannot get the "N/A" to output in the templates:

```
{store_telephone_data limit="1" offset="0"}
    {if store_telephone_data:no_results}
        <td>N/A</td>
        <td>N/A</td>
    {/if}
    {if store_telephone_data:count == 1}
        <td>
            {store_telephone_data:store_telephone_number}
        </td>
        <td>
            {store_telephone_data:store_telephone_type limit="1" offset="0"}
                {store_telephone_data:store_telephone_type:title}
            {/store_telephone_data:store_telephone_type}
        </td>
    {/if}
{/store_telephone_data}

```

# Answer
There is no `no_result` variable or condition for grid. Use `total_rows` instead.

```
{if store_telephone_data:total_rows >= 1}
    ...
{if:else}
    <td>N/A</td>
    <td>N/A</td>
{/if}

```
> 3 votes

# Answer
The grid field doesn't provide a no\_results tag. If you are using search filters on the grid field total\_rows will amount to a blank value due to the filters evaluating to true. There is an answer to a possible workaround but I see it as messy and either grid need to update their code or a small developed plugin could help.
> 0 votes

---
Tags: templates, grid
---


title: Referrer/URL Helper ee3?

text:
# Question
Title: Referrer/URL Helper ee3?
Really need the ability to grab the refering url that URL helper offered. Is this available for EE3 or is there an alternative?

# Answer
> 0 votes
I'm kind of late to the party, but I noticed Brian has an updated version of URL Helper in his github that looks ready for EE3, https://github.com/litzinger/URL-Helper/tree/master/third\_party/url\_helper

---
Tags: ee3, plugin, global-variables
---


title: Undefined index in custom field?

text:
# Question
Title: Undefined index in custom field?
I'm getting the following error when I turn on debugging.

```
Notice
Undefined index: m_field_ft_3

ee/legacy/libraries/channel_entries_parser/components/Custom_member_field.php, line 120

```

I don't get this error on the home page, but on individual story pages. This is from EE v 3.5.6.

# Answer
Error is missing a field in database. When you create a new member field, It creates two fields in DB under `exp_member_data` table.

1. m\_field\_id\_1
2. m\_field\_ft\_1

Your 1 field is there but ft field is missing. To solve this, Either you can delete the field from backend and create a new one or go to DB and create `m_field_ft_3` field. (Use data type as **TinyText**)
> 0 votes

---
Tags: members, error, custom-fields
---


title: EE3 Replace Image in File Manager

text:
# Question
Title: EE3 Replace Image in File Manager
How do you replace a file in fine manager in ee3? I cant believe this is not possible, there must be a way. :/

# Answer
> 0 votes
Hard to believe, but it is not possible to replace a file, You can only remove a file and add new file.

If you want to replace the file without EE file manager, You can access server via FTP s/w like filezilla and replace the image from your image path. That's the only solution of replace the file.

---
Tags: file-uploads, ee3, file-manager, ee
---


# Question
Title: how do I output am EE html template as a json file
how do I output am EE html template as a json file so it validates? Error:Invalid media type, expecting application/json.

I have tried enabling php to my template and adding the following code after all my data is parsed

But I get this in the output: {!-- ra:000000006fa9a5900000000053584a0b --}\[ and the file will not validate.

BUT if I copy and paste the outputted data into a json validator it validates. My only issue is the media type.

# Answer
As mentioned in another answer, you could go with the HTTP header plugin, but the same developer (Rob Sanchez) has also made a JSON plugin that allows for many more JSON specific settings.

If you are looking to install this to EE3, you'll need to make a couple of changes to the plugin files as the plugin itself was made for EE2. However the changes take less than 5 minutes to do. Check the GitHub issues tab for this info.
> 0 votes

# Answer
Install **"HTTP Header"** Plugin to set the EE html template as a json.

```
{exp:http_header content_type="application/json"}

```
> 2 votes

---
Tags: templates, json
---


title: Category page and Article. How?

text:
# Question
Title: Category page and Article. How?
EDIT!!!

It's not about categories, it's about addresses and templates.

I need to get 2 types of pages:

site.com/sport/football/ — page with lots of entry site.com/sport/football/realmadrid — page with one entry

Sport - group, Football - template, Realmadrid - it's entry ({url\_title})

The blog entry site.com/sport/football/realmadrid is built on the basis of the template Football. And it works well, the right address is obtained. But i need to have site.com/sport/football/ give a completely different template, in which there will be a list of all the records and with a different design. But it is already occupied by entry template.

# Answer
> 1 votes
take a look at Low's Seg2Cat. It's a free plugin that will allow you to use category names in the url to easily display the category contents on a page instead of messing with cat ids.

Using Seg2Cat will allow you to specify the category to use in your template tags without messing with cat\_id in the URL.

For example, you have a template group called products and you want to have a category display page. Lets use shirts as an example so you would have a template in the products group called shirts.

Your URL would be domain/products/shirts

To display a specific category on the shirts page you could set your channel entries tag to detect the 3rd segment as a category.

```
{exp:channel:entries channel="yourchannel" category="{segment_3_category_id}"}

```

This would allow you to use the 3rd segment to define the id. The brilliant thing is that you can just use your category\_url and seg2cat will work out the correct id to use. Following the example above, your url could be domain/products/shirts/mens\_dress\_shirts or domain/products/shirts/ladies\_knit\_shirts or whatever else. As long as the segment pattern has a valid category\_url, you should be fine and you can then use a single template to display multiple categories.

There are other tags available to display your category name, parent cat, etc. Check out the plugins documentation for more examples.

---
Tags: categories, templates, url
---


# Question
Title: PHP Version compatibility issue with EE module
I have created a plugin that is running good in PHP v5.5.x. When I upgrade my PHP version to 7.x it gives me errors.

Code that is suspicious is:

```
$this->EE =& get_instance();

```

Error is:

> only variables should be passed by reference

# Answer
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.
> 3 votes

# Answer
Pretty sure you don't need this in a plugin \`$this-\>EE =& get\_instance(); ref https://docs.expressionengine.com/v2/development/plugins.html
> 1 votes

---
Tags: ee3, module, php-errors, update, php7
---


title: How To Create Headers For A List

text:
# Question
Title: How To Create Headers For A List
I have a list of items. Each item has a season. I am trying to organize the items by season. I believe the list is pre sorted and I need to create a header everytime there item has a new season

In php I would imagine something like this

```
$nextSeason = "";
foreach($list as $item){
    $season = $item->season;
    if($nextSeason != $season){
        $nextSeason = $season;
        echo '<h1>' . $season . '</h1>'
    }
}

```

I have no clue how to accomplish this within the EE templating language

Here is the current code looping through the list:

```
{exp:stash:get_list:1 name="classes"
    against="class_category_ids"
    match="#(^|\&|\s){category_id}(.|$)#"
    prefix="classes"
}

    <div class="col-sm-3 class-info-container">
      {classes:class_card}
    </div>
{/exp:stash:get_list:1}

```

If i add `{classes:season}` it is printing out the season for every item.

I also do not understand what the `:1` is at the end of `{exp:stash:get_list:1}` I have looked at the documentation for stash but it does not have a reference for this.

I believe this site is running EE 2

# Answer
Tough to tell without the whole setting/getting picture, but definitely possible to recreate the effect of your php example with Stash. See: https://gist.github.com/croxton/6219973 for an example of setting and getting headers and also the individual items for each header. It should apply to what you're trying to do. Also: https://github.com/croxton/Stash/wiki/Lists#three-and-more-dimensional-lists

The ending ":1" in the module tag is probably used because that stash get\_list is within another stash tag pair. You can use any word (like "nested1", "nest2", "bubba" etc...) to differentiate each nested stash tag pair. I believe it's necessary due to the way eecms process module tags, but can't remember for sure.
> 0 votes

---
Tags: variable, ifelse, loop
---


# Question
Title: Solspace User and/or EE member management on screen messaging
I have a user:edit form so members can update their profile. When user submits the form it redirects to the same page. How would you print a message about the successful submission/update?

# Answer
What I've often done is this. /user/edit returns to /user/edit/success which is the same page. Then run a conditional on segment\_3 to display your message(s).
> 0 votes

---
Tags: members, solspace-user
---


# Question
Title: Column Width not working in EE3 Grid field when editing entry
Has anyone worked out how to get the Grid field in EE3 to follow the 'column width' parameters? I have a Grid 'row' that has a WYSIWYG field and I can't work out how to keep it from collapsing down - see attached image. Thanks in advance!

# Answer
The "column width" parameters does not seems to be used for now.. What i did is modify themes/ee/cp/css/common.min.css Because my screeen is 1920px wide.. i change the max-width of .col-group to 1500px.. at least i see more!.. AND i commented the `.grid-input-form th {/* min-width:220px*/}` Hope it will help!
> 2 votes

# Answer
For whatever reason the option to set columns widths is not observed. I recall EL claiming it was necessary for the CP to be responsive in ee3. I find that ridiculous as it is easy enough to implement a mobile and desktop view with min/max widths, media queries and maybe a little JS. We all do it everywhere, all the time.
> 1 votes

---
Tags: grid, ee3
---


# Question
Title: Solspace Freeform return path {csrf_token}
I am having an issue, probably parse related. Using Solspace Freeform I am trying to include the {csrf\_token} in the return path but its not working.. my code is as follows for the form:

```
{exp:freeform:form
                   form_name="whitepapers"
                   required="email|full_name|company|job_title|whitepaper|my_unique_hash|partner"
                   return="/{segment_1}/{csrf_token}"
                   inline_errors="yes"
                }

```

It returns to domain.com/segment/%7Bcsrf\_token%7D with an error: Error: The URI you submitted has disallowed characters.

I am trying to use the CSRF token to check against buy storing it in a hidden field and using it to display the entry on the return. From this example: http://support.solspace.com/support/solutions/articles/4000032469-how-to-make-freeform-forms-editable-without-using-the-entry-id-in-the-url

Could anyone shed some light or offer a way to do this?

Thanks in advance

# Answer
> 1 votes
This is likely due to parse order, where the `{csrf_token}` variable wouldn't be parsed yet until the `{exp:freeform:form}` tag has fully rendered, which would be after the parameters have been parsed.

---
Tags: solspace-freeform, solspace, parse, csrf
---


# Question
Title: Editor field outputs Site Page links as {page_xxx} variable
When using the link dialog to add a link to a Site Page, the URL looks correct in the Editor, but when the page is rendered, it just spits out {page\_xxx} and not the URL. What could I possibly be doing wrong?

Site is running EE 2.11.3 and Editor 3.2.4

# Answer
I'm seeing this problem because I'm rendering the field content inside a Category Sorted Entries tag. That add-on can't handle complex custom field data.
> 0 votes

---
Tags: devdemon, editor
---


title: Can't Limit Freeform Entries Above 50

text:
# Question
Title: Can't Limit Freeform Entries Above 50
I'm trying to make use of code much like the solution provided to this user (Limit a FreeForm based on a maximum number of allowed entries?) to hide the form after a certain number of entries is reached.

The issue I've found is that the conditionals work up to 50, but not beyond that point... and I'd like to hide the form automatically when 200 entries are reached.

Does anyone know how to do this? This is the code I'm using:

```
{exp:freeform:entries form_name="conference_2017"}
{if '{freeform:count}' == 1}
{if '{freeform:total_results}' < 200}
<p>All fields below are required. Thank you!</p>
{exp:freeform:form form_name="conference_2017" required="full_name|title|organization|email|phone|mailing_address|postal_code" form:id="contact_form" form:class="contact_form" return="conference/registered" secure_action="yes"}
<! -- Form Content -->
{/exp:freeform:form}
{/if}
{if '{freeform:total_results}' >= 200}<p>Due to exceptionally strong interest we’ve reached our registration limit. If you have any questions or would like to enquire about the possibility of attending, please contact XXXXX at {encode="XXXXX" title="XXXXX"}.</p>{/if}{/if}
{/exp:freeform:entries}

```

I'm using Freeform Pro 4.2.5 on EE 2.11.7.

Thank you!

# Answer
> 1 votes
This is likely because the default limit for `{exp:freeform:entries}` template tag is `50`. So you'll just need to specify the `limit` parameter with a value of `200`. :)

`{exp:freeform:entries
 form_name="conference_2017"
 limit="200"
}`

---
Tags: solspace-freeform, solspace
---


# Question
Title: Blank page output when using Entry Status in nested Switchee statement
I am trying to use a nested Switchee statement to display an embedded template but the results are a blank page. Using default status group and EE 2.11.5. I feel like I am missing something basic here.

*The logic is:* If SEGMENT 2 is NOT BLANK then display correct embedded template based on the Entry Status.

PASS (shows \_sometemplate\_home): xyz.com/somegroup
FAIL (shows blank): xyz.com/somegroup/open-status-entry
FAIL (shows blank): xyz.com/somegroup/closed-status-entry

```
<!-- COMPLETE somegroup/index.html template -->

{exp:switchee variable="{segment_2}" parse="inward"}

{case value="''"}
    {embed="somegroup/_sometemplate-home"}
{/case}

{case value="#^P(\d+)$#"}
    {embed="somegroup/_sometemplate-home"}
{/case}

{case default="Yes"}
    {switchee variable="{status}" parse="inward"}

        {case value="open"}
            {embed="somegroup/_sometemplate-open"}
        {/case}

        {case value="closed"}
            {embed="somegroup/_sometemplate-closed"}
        {/case}

    {/switchee}
{/case}
{/exp:switchee}

```

# Answer
> 1 votes
As @checyney said there is no channel:entries loop yet. I'd suggest you do it something like this:

```
{case default="Yes"}
    {exp:channel:entries}
        {switchee variable="{status}" parse="inward"}

            {case value="open"}
                {embed="somegroup/_sometemplate-open" the_entry_id="{entry_id}"}
            {/case}

            {case value="closed"}
                {embed="somegroup/_sometemplate-closed" the_entry_id="{entry_id}"}
            {/case}

        {/switchee}
    {/exp:channel:entries}

{/case}

```

---
Tags: ee2, templates, switchee
---


# Question
Title: How to relate 2 channels / parent relationship fields HELP
can someone help me get my head around a relationship field / parent? I have 2 channels. Clinic and People. The people channel has a relationship field to the clinic they work at. When I am displaying the clinic channel I want to display the people that work there. This is not working:

Channel: Clinic Field: Title

Channel: People Field: {member\_clinic} relationship field to Clinic

```
{ exp:channel:entries channel="clinic" limit="1" dynamic="yes"}
Clinic Name: { title }
People at this clinic: {parents channel="people" field="member_clinic"}
                                <div class="show">
                                        <strong>{parents:title}</strong>
                                        <div class="what">{parents:member_lastname}</div>
                                        <div class="when">{parents:member_firstname}</div>
                                </div>
                        {/parents}{ /exp:channel:entries }

```

# Answer
All you should need is this. Assuming "parents" is the name of the relationship field in the Clinic channel. ref https://docs.expressionengine.com/latest/fieldtypes/relationships.html#accessing-children

```
{parents}
<div class="show">
<strong>{parents:title}</strong>
<div class="what">{parents:member_lastname}</div>
<div class="when">{parents:member_firstname}</div>
</div>
{/parents}

```
> 1 votes

---
Tags: relationships, related-entries, reverse-related-entries
---


# Question
Title: {stash:embed name="test"} vs {exp:stash:embed name="test"}
I had a parsing problem with:

```
{stash:embed name="test"}

```

It was not parsing.

Reading many posts I read about:

```
{exp:stash:embed name="test"}

```

And it's parsing fine. What are the difference between them ??? I'm curious, because **exp:stash:embed** doesn't appears in the Tag reference documentation.

# Answer
Stash embeds can be parsed at three different stages in the parse order of their parent template:

* `process="start"` \- embed the template before any other variables and tags in your template are parsed. The tags in the embed will be fully parsed before being included in the parent template, unless you set `parse="no"`. If you do set `parse="no"`, the embed behaves like a native EE template partial.
* `process="inline"` \- embed the template in the "natural" parse order of the template. This means EE parses the embed like any other tag.
* `process="end"` (default) - embed the template at the end of template parsing after other tags and variables in the parent template have been parsed. This is like EE's standard embed.

To enable the `process="start"` functionality, it was necessary to use an extension hook (`template_fetch_template`) to parse the Stash embeds before EE's main parsing routines are run. This hook looks for embeds beginning `{stash:embed...}`, checks if they need to be parsed immediately, and if not replaces them with the tag form `{exp:stash:embed...}` for parsing by EE later on.

If the embed syntax `{stash:embed}` was not parsing it must be because there was a problem with Stash being triggered on the `template_fetch_template` hook. That could be because another add-on using the same hook is not checking the value of `ee()->extensions->last_call` or is not returning a value as it should. Or it could be that the Stash extensions are not installed or enabled.

You can disable other add-on extensions one-by-one to determine if a conflict is the cause of your issue. And you should check that the following extensions are installed and enabled for Stash in exp\_extensions table:

* stash\_fetch\_template
* stash\_post\_parse
* template\_fetch\_template
* template\_post\_parse

Using the `{exp:stash:embed}` syntax is fine providing you don't need to use the `process="start"` functionality.
> 2 votes

---
Tags: stash, parse-order, parsing
---


title: Expresso Store with PHP7

text:
# Question
Title: Expresso Store with PHP7
I have a client running Expresso Store 2.5.1 with EE 2.10.1. I have to upgrade the server and need to know if Store 2.5.1 will run on PHP 7.1.

Since Store has not been updated to run under EE 3.x, I'm kinda stuck between a rock and a hard place with upgrading.

Any help is appreciated.

# Answer
> 1 votes
(I'm with Vector; we own Store)

We're very close to releasing Store for EE3, with full PHP 7 support. You can sign up to be part of our beta test here: https://goo.gl/forms/6p2W9Fwy8fTeQ3fE2

I know it's been "in progress" for a long time, but much of that was under the previous owners. Our 1 priority post-acquisition has been getting it EE3 compatible and we're extremely close there.

---
Tags: expresso-store, php7
---


# Question
Title: Resourse Router - Only route for entries in one channel
Is there a way to use Resources Router to only route for entries in one particular channel, then for everything else, use the normal EE template structure?

I've tried:

```
':any'  => function($router, $wildcard_furniture) {
           if ($wildcard_furniture->isValidEntry(array('channel' => 'furniture'))) {
           $router->setTemplate('product-category/index');
         } else {
      $router->stopRouting();
    }
       }

```

# Answer
This should work:

```
$config['resource_router'] = array(

    ':any' => function($router, $wildcard) {
        if ($wildcard->isValidUrlTitle( array('channel' => 'furniture') )) {
            $router->setTemplate('product-category/index');
        }
    },

};

```

If there's no match then no template would be set and ee carries on.

I would think it's faster if you can narrow the url possibility down because then that db call will only happen on matched pages (i.e.: domain.com/furniture/chair):

```
    'furniture/:any' => function($router, $wildcard) {
        if ($wildcard->isValidUrlTitle ... etc....

```
> 1 votes

---
Tags: resource-router
---


# Question
Title: Redirect due to "malicious or dangerous" code
All my efforts at "view rendered" are met with "Error: The link you are being redirected to contained some potentially malicious or dangerous code. We recommend you hit the back button and email \[my email\] to report the link that generated this message.

This is my exploratory effort upon installation.

# Answer
I had this happen a few weeks ago. I don't remember all the details (of course), but it was an Apache ModSecurity rule being triggered by navigating to the admin. Some of the url words flagged a security keyword.

Getting around this involved finding the rule being triggered and removing it.

Look at ModSecurity Tools in WHM:

1. Find the rule id being triggered for the url you were trying to access.
2. Override the rule: On Rules List \> Edit Rules add in a directive to override the rule when matched, like (with the correct id instead of 123456).

:

```
<locationmatch "^/my-custom-ee-admin-name/index.php.*">
  SecRuleRemoveById 123456
</locationmatch>

```

https://documentation.cpanel.net/display/ALD/ModSecurity+Tools

examples of location matching for disabling modsec rules
> 1 votes

---
Tags: templates
---


title: Postmaster Parcels Page is Blank

text:
# Question
Title: Postmaster Parcels Page is Blank
Good Afternoon, Today I experienced a strange issue with Postmaster 1.4.3 on an EE 2.5.2 site and I'm hoping someone might have some tips to resolve this. What's happening is when I visit my control panel, then pull up the Modules list and click on Postmaster, I'm getting a blank white page. I went to the admin.php file in the root and changed the debugging to 1 and refreshed the page, the following error message was then received:

```
A Database Error Occurred
Error Number: 1054

Unknown column 'exp_channel_data.field_id_867' in 'field list'

SELECT exp_channel_data.entry_id, exp_channel_data.channel_id,    exp_channel_titles.author_id, exp_channel_titles.title, exp_channel_titles.url_title, exp_channel_titles.entry_date, exp_channel_titles.expiration_date, status, exp_channel_titles.`entry_id`, exp_channel_titles.`channel_id`, exp_channel_titles.`title`, exp_channel_titles.`author_id`, exp_channel_titles.`entry_date`, exp_channel_titles.`expiration_date`, exp_channel_titles.`status`, exp_channel_data.`field_id_867` as 'employee_access_code', exp_channel_data.`field_id_866` as 'assignment_period', exp_channel_data.`field_id_865` as 'employee_title', exp_channel_data.`field_id_864` as 'employee_needing_access', exp_channel_data.`field_id_863` as 'areas_needing_access', exp_channel_data.`field_id_862` as 'branch_name', exp_channel_data.`field_id_861` as 'access_requested' FROM (`exp_channel_titles`) JOIN `exp_channel_data` ON `exp_channel_titles`.`entry_id` = `exp_channel_data`.`entry_id` WHERE `exp_channel_data`.`channel_id` = '121' ORDER BY `exp_channel_titles`.`channel_id` DESC LIMIT 100

Filename: third_party/postmaster/libraries/Channel_data/Channel_data_lib.php

Line Number: 1189

```

I have a staging copy of this same site and the Parcels list for Postmaster is coming up just fine on staging when I pull up the Modules list and click on Postmaster. At this point I made some backups of the main site and attempted to copy over the parcels table from staging. I thought perhaps one of the recent parcels I created caused this and the staging site was two parcels behind, so I took note of the two parcels I would need to recreate then I deleted the exp\_postmaster\_parcels table from the main site and imported the one from staging. This did not resolve the problem though and I have since restored the original parcels table. I also tried restarting the Apache service and clearing all caches using Tools, Data, Clear Caching. The last thing I have tried so far was to copy over the postmaster folder (/system/expressionengine/third\_party/postmaster) from staging to the main site. This didn't resolve the issue either. The error message received seems to be the result of a field Postmaster is looking for in exp\_channel\_data that doesn't exist. Could I safely create this field in the exp\_channel\_data table to prevent the error and proceed to the Parcels list?

The good news is I can see my existing Parcels are still working as there is activity in the exp\_postmaster\_mailbox table from recent Postmaster notifications. I just can't add any new Parcels at this time or edit any of the existing ones due to the database error I'm getting in the control panel when I attempt to access the Parcels list. Any tips or suggestions for resolving this issue and restoring my access to Postmaster in the Control Panel would be greatly appreciated, Thanks!!

# Answer
> 1 votes
The SQL error is due to a channel field being missing. (field\_id\_867) and as such I don't think its a problem with postmaster directly.

Did you by chance add a channel field on your staging server and not add it on the production server?

---
Tags: postmaster
---


# Question
Title: EE3 --> Multiple Concurrent Database Connections via config files
we converted to **3.3.3** from **2.5.5**.

a concurrent connection to a secondary database (set up using `Focus Lab Master Config` in both versions) works in **2.5.5** but i get warnings in **3.3.3** with message Warning

> Illegal string offset 'hostname'.

it finally completely fails when it tries to run the query and prefixes tables with the primary connection db name instead of the secondary db name.

its loading the primary connection db instead of the secondary connection - all tables names are prefixed with primary connection db name.

we used this syntax in **2.5.5** \- `$this->EE->load->database('secondary_connection', TRUE);`

and in the environment specific config for my local is

```
$env_config['database'] = array (

'expressionengine' => array (
        'hostname' => 'localhost',
        'username' => 'xxxx',
        'password' => 'xxxxx',
        'database' => 'xxxxx',
        'dbdriver' => 'mysqli',
        'dbprefix' => 'exp_',
        'pconnect' => FALSE
    ),

'ext_db_components' =>
    array (
            'hostname' => 'localhost',
            'username' => 'xxxxx',
            'password' => 'xxxxx',
            'database' => 'xxxxx',
            'dbdriver' => 'mysqli',
            'dbprefix' => '',
            'pconnect' => FALSE,
            'cache_on' => FALSE,
    ),

);

```

the error appears on a page that calls a model.

in one of the model methods, it needs to access an external db (housed on same mysql server).

in **EE2**, loading that external connection using
`$this->components_db = $this->EE->load->database('ext_db_components', TRUE);`
let us query against it using active record.

the same line of code in **EE3** throws Illegal string offset 'hostname' warnings before finally failing with a mysql exception.

**FYI** \- it does appear to be calling the legacy db.php connector (/system/ee/legacy/database/DB.php) rather than the EE3 db connector

is there a way to concurrently connect to an external db using config settings in 3.3.3?

**NOTE:** I am not asking about switching primary connections based on environment - i need multiple concurrent connections in the same environment.

# Answer
> 4 votes
Please see the documentation for full details: Connecting to an External Database

But the basic pattern for spinning up a separate DB connection in v3 would be:

1. Create a `DBConfig` object from your database's connection settings
2. Create a new `Database` object using the `DBConfig` object
3. Issue queries to a `Query` object on the new database with `->newQuery()`, using all standard methods (`select()`, `get()`, etc.)

Step 1 is accomplished with the following (ensure that your class references the namespace with `use EllisLab\ExpressionEngine\Service\Database;`:

```
$db_config = new Database\DBConfig(ee('Config')->getFile());
$db_config->getGroupConfig('other_db');

```

Step 2 with:

```
$db = new Database\Database($db_config);

```

And Step 3, your queries with:

```
$query = $db->newQuery()->get('my_table');

```

That pattern is best implemented as services in your `addon.setup.php` file. This makes sure you are only connecting one time for each page request, and keeps your syntax simple, and consistent with connections to ExpressionEngine's database.

```
'services' => array(

  // This service will be used to query our external database
  // e.g., ee('my_addon:db')->select()
  'db' => function($addon)
  {
    return $addon->make('my_addon:Database')->newQuery();
  },

  // This service manages our external database connection
  // e.g., ee('my_addon:Database')->getLog()
  'Database' => function($addon)
  {
    // Makes sure we only do this work once per page request
    static $db;

    if (empty($db))
    {
      // fetch config from system/user/config/my_addon_database.php
      $config = ee('Config')->getFile('my_addon_database');

      // create the DBConfig object
      $db_config = new Database\DBConfig($config);

      // select the database connection group
      $db_config->getGroupConfig('my_addon');

      // connect to and make the Database object
      $db = new Database\Database($db_config);
    }

    return $db;
  }
)

```

Doing this will let you make calls using `ee('my_addon:db')->` exactly as you would `ee('db')->` to the ExpressionEngine database.

---
Tags: database, focus-lab-master-config
---


# Question
Title: how to get EE3 Grid data filled out on frontend
I have a grid with 4 columns that i'm trying to get before they click submit. Each time they add a row (non member player) in this grid I need to grab that rows data and use it with PHP to show information based off their gender and expected ranking.

When I inspect the input box in dev tools, it doesn't seem to spit out that data so i'm having trouble triggering as I don't know how it stores that data. I would've thought it would've changed the "value" of that input. A columns input looks something like this after I enter "testname":

```
<input type="text" name="non_member_players[rows][new_row_1][col_id_9]" value="" dir="ltr" field_content_type="all" maxlength="256">

```

# Answer
> 1 votes
Think I found it. Despite the dev tools not showing the actual value on the input that was filled in, i was able to grab data based off the name attr and it spits out the filled in data still.

```
$('input[name="non_member_players[rows][new_row_1][col_id_9]"]').val();

```

---
Tags: ee3, grid
---


title: What is Form Layouts?

text:
# Question
Title: What is Form Layouts?
Seems a a beginner question, but what it is the Form Layouts inside the Manage Channels?

After creating a form layouts, what is its use? How to use it ?? I didn't remenber at all what it is a form layouts....

Thanks.

# Answer
> 4 votes
Form layouts is where you can setup the input form and fields for entering data via the Create or Edit entry pages.

You can save a layout for specific users per channel so that a given user will see the entry form that you have saved to a layout. In this way, you can reorder or hide fields as needed.

For example, say you have a user that you don't want to have input certain fields. You can create a layout for that user so that the fields you don't want them to see are hidden.

Note that you can also customize the available tabs like date, options, etc and even drag and drop the tab fields between other tabs. In this way, you could make a layout that has the date fields and entry status on a single sheet and completely do away with tabs if you wanted to.

Hope that helps.

---
Tags: channel, layouts
---


# Question
Title: How do I solve this error: Unable to load requested publish tab file: tab.tag.php
I just upgraded from EE 2 to EE 3 and in the process removed Solspace Tag from the configuration by uninstalling it in EE 2.

Now however while running EE 3.5.7, when I try to edit any entries in the control panel I get the following error:

> Error: Unable to load requested publish tab file: tab.tag.php

Since I no longer need Solspace Tag I need to know how to resolve this issue without having to purchase the add-on.

Thanks.

# Answer
Did you completely uninstall Tag while in EE2? It sounds like you may not have. If you need a copy of Tag 5.x for EE3 to quickly uninstall Tag, just contact our support. :)

https://solspace.com/expressionengine/create-ticket/tag
> 1 votes

---
Tags: solspace-tag
---


title: New EE3 installation and other SQL-base

text:
# Question
Title: New EE3 installation and other SQL-base
Sorry for my bad English.

I have a website on EE1. I want EE3. There is a big problem with convert database (old PHP and MySQL on the server and can't converted via EE2, and if i update the PHP and MySQL, my EE1 will not work).

That's what I came up with: put on a separate host of EE3 and just fill the database manually. Then update the PHP and MySQL on the main server, install EE3 and add there the backup of the newly database.

Is this a good idea? What should I know?

# Answer
Never ever do direct EE1 to EE3. First of all upgrade EE1 to EE2. That will make necessary changes to your database. (Remember change all the plugins with EE2 version otherwise backend and/or frontend may crash.)

After upgrading it to EE2, upgrade your server then upgrade site to EE3.

Remember to:

1. Always take a backup copy of your site.
2. Its good to upgrade site on local like xampp. Fast and easy.
3. Always upgrade plugin after upgrading site.
4. Test the whole site to confirm everything is working fine.
5. EE1 to direct EE2.11 may cause some issue. Better option is to upgrade it to first minimal version of EE2 (Like EE2.5) and then upgrade to maximum version of EE2 \[just for not taking chance to direct jump.\]
> 1 votes

---
Tags: database, update, migration, install, database-migrations
---


# Question
Title: MSM Server Path Problems after upgrade to EE3
I am in the process of upgrading an MSM configuration from EE 2.11.x to 3.5.7 and have run into the following error on the MSM site:

> Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php

Before the upgrade the path I was using to reference the system folder was this:

```
/home/sitename/public_html/system/

```

That has not changed but now I get the error message.

Any guidance on how to resolve this?

# Answer
> 1 votes
Turns out in this case that it was server settings that were preventing the communication between sites. It required:

* Mod\_ruid was disabled
* suPHP enabled
* FileProtect in Home »Server Configuration »Tweak Settings turned off

Great support from KnownHost.

---
Tags: multi-site-manager
---


# Question
Title: Receiving error code that seems to be locking up the Edit Channel Search function
I am new to EE and hoping for some help. Currently using version 2.5.5. Received the following error code:

```
A PHP Error was encountered
Severity: 8192
Message: Non-static method Calendar_upd::_default_preferences() should not be called statically, assuming $this from incompatible context
Filename: calendar/data.calendar.php
Line Number: 338

```

Since this began appearing, the Edit Channel search function is not working. Just get the spinning wheel, no results. Any suggestions on how to resolve would be appreciated. Thanks!

# Answer
sounds like a php method or class in the calendar module/extension needs updating. I don't have a calendar module to verify this, but in the past when I've ran into this issue it can usually be fixed by modifying the method call.

Can you look at the calendar/data.calendar.php file around line 338 and see if there is a function that references Calendar\_upd.

Its probably something like

```
function thisIsTheFunctionName(){...

```

you can try changing the function to this

```
public static function thisIsTheFunctionName(){...

```
> 1 votes

---
Tags: ee2, search, php, error, php-errors
---


# Question
Title: How to edit channel entries in expression engine depending on the order they are displayed
I am exporting news articles into a page using channel entries in expression engine. I want the first article that appears to be 'col-md-4' the next 2 articles to be within 'col-md-3' the next 2 to be within 'col-md-3' and the last 3 articles to be within a 'col-md-2' container.

I have tried various ways to do this. I thought I had worked it out with the code below by editing the entries using an {if:else} statement and using the {count} variable. Although I realised I was selecting the entrie with that ID for example {count == 1} was the article with ID 1, not the first article to appear on the page.

Does anyone know how I can edit an article depending on the order it appears on the page?

```
 {exp:channel:entries channel="news|blogs" limit="8" dynamic="no"}

            {if count == 1}
            <div class="col-md-4">
                <div class="item news-v2">
                    <div class="news-v2-badge">
                        {if news_thumbnail == ""}
                        <a href="/news/article/{url_title}">
                            <img class="lazyOwl img-responsive" src="home_logo_filler_news_events.png" alt="">
                        </a>
                        {if:else}
                        <a href="/news/article/{url_title}">
                            <img class="lazyOwl img-responsive" src="{news_thumbnail}" alt="">
                        </a>
                        {/if}

                    </div>
                    <h4><a href="/news/article/{url_title}">{title}</a></h4>
                    <p>{news_tagline}</p>
                    <p>
                        <span>{entry_date format="%d"}</span>
                        <small>{entry_date format="%M"}</small>
                        <small>{entry_date format="%Y"}</small>
                    </p>
                </div>
            </div>
            {if:elseif count == 2 || count == 3 || count == 4 || count == 5}
            <div class="col-md-3">
                <div class="item news-v2">
                    <div class="news-v2-badge">
                        {if news_thumbnail == ""}
                        <a href="/news/article/{url_title}">
                            <img class="lazyOwl img-responsive" src="home_logo_filler_news_events.png" alt="">
                        </a>
                        {if:else}
                        <a href="/news/article/{url_title}">
                            <img class="lazyOwl img-responsive" src="{news_thumbnail}" alt="">
                        </a>
                        {/if}

                    </div>
                    <h4><a href="/news/article/{url_title}">{title}</a></h4>
                    <p>
                        <span>{entry_date format="%d"}</span>
                        <small>{entry_date format="%M"}</small>
                        <small>{entry_date format="%Y"}</small>
                    </p>
                </div>
            </div>
            {if:elseif count == 6 || count == 7 || count == 8}
            <div class="col-md-2">
                <div class="item news-v2">
                    <h4><a href="/news/article/{url_title}">{title}</a></h4>
                    <p>{news_tagline}</p>
                    <p>
                        <span>{entry_date format="%d"}</span>
                        <small>{entry_date format="%M"}</small>
                        <small>{entry_date format="%Y"}</small>
                    </p>
                </div>
            </div>
            {/if}

            {/exp:channel:entries}

```

# Answer
> 1 votes
You could also use `{switch}` to vary the div classes. Not sure if this is a better way, but its an alternative to if/else

```
<div class="col-md-{switch='4|3|3|3|3|2|2|2'}">

```

Just remember that switch loops, so after the 8th entry you'll get a col-md-4 again.

# Answer
> 0 votes
Not sure what order you're wanting to output the entries, but assuming it's date:

```
{exp:channel:entries
    channel="news|blogs"
    limit="8"
    dynamic="no"
    orderby="date"
    sort="desc"
}
    {if count == 1}
        <div class="col-md-4">
            ...
        </div>
    {if:elseif count <= 5}
        <div class="col-md-3">
            ...
        </div>
    {if:else}
        <div class="col-md-2">
            ...
        </div>
    {/if}
{/exp:channel:entries}

```

Or if wanting to order by entry\_id from latest, use parameter:

```
orderby="entry_id"

```

https://docs.expressionengine.com/latest/channel/channel\_entries.html#id46

---
Tags: channel-entries, count
---


# Question
Title: How is the ExpressionEngine user guide documentation managed? By categories or channels with relationship fields to the child pages?
I would like to create a user guide for my website which functions the same way as the ExpressionEngine user guide / docs. Seen here.

I would like to know how they structure their pages. Do they use categories, if so how? Or do they use 1 channel for the parent articles with a relationship field pointing at another channel for the child articles?

Do they use an add-on ? I was also thinking that they may have used a customised version of the ExpressionEngine Wiki to achieve the user guides?

I tried Googling it but came across nothing. What do you think the best approach would be in creating such a thing?

Thanks,

Sam

# Answer
> 1 votes
Last I heard (some years ago), it was all handled via Sphinx: http://www.sphinx-doc.org/ No idea if that's still true though.

---
Tags: categories, relationships, channel, structure, wiki
---


# Question
Title: Adding CKEditor Plugins to Wygwam 4.0.9 in EE3
I'm attempting to add a **CKEditor plugin** to **Wygwam 4.0.9** in **EE3**, but the documentation I found in pixelandtonic and wygwam docs showing wrong upload folders.

There is no such folders as `themes/third_party/` and `system/expressionengine/third_party/` .

Please confirm the exact folder names where I will upload the PHP files.

# Answer
In **EE3** :

Theme third-party folder path is as follow:
`themes/user/`

System third-party folder path is as follow:
`system/user/addons/`
> 1 votes

# Answer
I have uploaded smiley plugin to themes/user/smiley and created following ext.smiley.php and uploaded to system/user/addons/smiley, but the plugin is not appearing.

```
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');

class smiley_ext
{
var $name           = 'smiley';
var $version        = '1.0';
var $description    = '';
var $docs_url       = 'http://ckeditor.com/';
var $settings_exist = 'n';

private $_hooks = array(
    'wygwam_config',
    'wygwam_tb_groups',
);

private static $_included_resources = FALSE;

public function activate_extension()
{
    foreach ($this->_hooks as $hook)
    {
        ee()->db->insert('extensions', array(
            'class'    => get_class($this),
            'method'   => $hook,
            'hook'     => $hook,
            'settings' => '',
            'priority' => 10,
            'version'  => $this->version,
            'enabled'  => 'y'
        ));
    }
}

public function update_extension($current = NULL)
{
    return FALSE;
}

public function disable_extension()
{
    ee()->db->where('class', get_class($this))->delete('extensions');
}

public function wygwam_config($config, $settings)
{
    if (($last_call = ee()->extensions->last_call) !== FALSE)
    {
        $config = $last_call;
    }

    // Check if our toolbar button has been added
    $include_btn = FALSE;

    foreach ($config['toolbar'] as $tbgroup)
    {
        if (in_array('MyPlugin', $tbgroup))
        {
            $include_btn = TRUE;
            break;
        }
    }

    if ($include_btn)
    {
        // Add our plugin to CKEditor
        if (!empty($config['extraPlugins']))
        {
            $config['extraPlugins'] .= ',';
        }

        $config['extraPlugins'] .= 'myplugin';

        $this->_include_resources();
    }

    return $config;
}

private function _include_resources()
{
    // Is this the first time we've been called?
    if (!self::$_included_resources)
    {
        // Tell CKEditor where to find our plugin
        $plugin_url = URL_THIRD_THEMES.'smiley/myplugin/';
        ee()->cp->add_to_foot('<script type="text/javascript">CKEDITOR.plugins.addExternal("myplugin", "'.$plugin_url.'");</script>');

        // Don't do that again
        self::$_included_resources = TRUE;
    }
}

public function wygwam_tb_groups($tb_groups)
{
    if (($last_call = ee()->extensions->last_call) !== FALSE)
    {
        $tb_groups = $last_call;
    }

    $tb_groups[] = array('MyPlugin');

    // Is this the toolbar editor?
    if (ee()->input->get('M') == 'show_module_cp')
    {
        // Give our toolbar button an icon
        $icon_url = URL_THIRD_THEMES.'smiley/myplugin/icons/smiley.png';
        ee()->cp->add_to_head('<style type="text/css">.cke_button__myplugin_icon { background-image: url('.$icon_url.'); }</style>');
    }

    return $tb_groups;
}

}

```
> 0 votes

---
Tags: wygwam, ee3, ckeditor
---


title: ICS_Subscription enable ICS Sharing

text:
# Question
Title: ICS_Subscription enable ICS Sharing
The docs say

"To enable this feature, make sure to enable ICS Sharing, click the green icon button in Manage column for the applicable calendar(s) on the list view of calendars in the Calendar control panel. "

And I don't see how to enable this anywhere in the current build of Calendar.

Please send a clue.

Thanks.

# Answer
> 0 votes
You first need to make sure you're using Calendar 2.3.0+

Then, go to CP -\> Calendar -\> Calendars page and you'll see the button in the **Manage** column. :)

---
Tags: solspace-calendar
---


# Question
Title: Stopping WYGWAM from assigning dimensions to images
Is it possible to stop WYGWAM from putting dimensions on images as inline styles. We want the images to be responsive.

Thanks for any advice.

# Answer
You need to create a custom config file for CKEditor that redefines how HTML is generated for images. Create a JavaScript file called something like 'ckeditor\_config.js' and then set Wygwam to use it. You can do this by adding an advanced setting to your Wygwam editor configuration. Add the 'customConfig' setting and enter the path to the JavaScript file you just created. It will look like:

`/javascripts/ckeditor_config.js`

Enter the following code into the config file. The code is from the CKEDITOR - prevent adding image dimensions as a css style question on Stackoverflow. I've modified it slightly, so that the dimensions aren't added as attributes on the image.

```
CKEDITOR.on('instanceReady', function (ev) {
ev.editor.dataProcessor.htmlFilter.addRules(
    {
        elements:
        {
            $: function (element) {
                // Remove width and height style rules from images
                if (element.name == 'img') {
                    var style = element.attributes.style;

                    if (style) {
                        // Get the width from the style.
                        var match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec(style),
                            width = match && match[1];

                        // Get the height from the style.
                        match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec(style);
                        var height = match && match[1];

                        if (width) {
                            element.attributes.style = element.attributes.style.replace(/(?:^|\s)width\s*:\s*(\d+)px;?/i, '');
                        }

                        if (height) {
                            element.attributes.style = element.attributes.style.replace(/(?:^|\s)height\s*:\s*(\d+)px;?/i, '');
                        }
                    }
                }

                if (!element.attributes.style)
                    delete element.attributes.style;

                return element;
            }
        }
    });
});

```
> 19 votes

# Answer
Following on from Aelvan's answer here is the code I use to automatically resize images in Wygwam fields and remove the dimensions. It also stops them adding stupidly large images. It requires CE Image, but why wouldn't you have that installed anyway?

```
{exp:ce_img:bulk max="300" crop="no" allow_scale_larger="no" add_dims="no" attributes='style="float: right; margin-left:2%;"'}
{wygwam_field name}
{/exp:ce_img:bulk}

```
> 3 votes

# Answer
For responsive websites, I generally have had better luck defining separate fields for images. It gives you better control than letting people include images and other media directly in WYSIWYG fields, especially with RWD.

Back to your question, I believe it can be done relatively easily at the CK Editor level, not in Wygwam. Here is a post on stackexchange you can inspire yourself from. Basically you have to use CK Editor's Data Processor and HTML Parser filters. Just a bit of Javascript to write. Not really complicated.

EDIT: Seeing what Dylan posted, you could also just remove the style attribute altogether, if all you need is a bare img tag.

```
    CKEDITOR.on('instanceReady', function (ev) {
ev.editor.dataProcessor.htmlFilter.addRules(
    {
        elements:
        {
            $: function (element) {
                // Remove style attribute from images
                if (element.name == 'img') {
                    delete element.attributes.style;
                }

                return element;
            }
        }
    });
});

```
> 2 votes

# Answer
I don't think it's possible to do in WYGWAM itself. But you can use the CE Image bulk tag and/or EZ Image Resize to fix this in your templates. And you have the added benefit of being able to set a maximum width/height to save filesize.
> 0 votes

# Answer
As long as your uploaded image isn't too big then you can set the height and width to 100%. Seems to work well for me!
> 0 votes

# Answer
There is a rather ugly UX issue with completely removing the style property.

The user gets confused since the dimensions are there to set and since it's a WYIWYG editor rightfully expects some correlation between his editing and the final layout, yet we take that away.

Even worse we prevent the user from setting image sizes completely.

A common issue with users is that they have no concept of image preparation. So they are not going to use Photoshop or some other tool to properly size, crop, color correct, etc their images.

They go into Wygwam like they go into Word and start messing things up.

So the proper solution is one where we obey the sizes they set as long as they don't exceed the parent element's sizes - in other words they stay in control but we prevent the layout from falling apart when - only when - their size exceeds the parent element's size.

this inline code:

```
style="width:530px; heigt:320px;"

```

should become like this:

```
style="max-width:530px; max-height:320px; width:100%; height:auto;"

```

instead of the complete removal of the whole style attribute.

I run a function after the page load that replaces the inline style attribute.

```
function replaceStyle() {
var imageStyle = $(this).attr('style');
imageStyle = imageStyle.replace('width', 'max-width');
imageStyle = imageStyle.replace('height', 'max-height');
imageStyle = imageStyle + ' width:100%; height:auto;';
$(this).removeAttr('style').attr('style', imageStyle);
}

$('img').each(replaceStyle);

```

but obviously it'd be better to implement this idea in a CKEditor custom\_config.js, or better yet if CKEditor would use this idea by default but that's beyond my Javascript skills.
> 0 votes

---
Tags: ee2, wygwam, twitter-bootstrap
---


# Question
Title: Cart throb % coupon discounts calculation incorrect
When i set the percentage off to 20% in a coupon and make a purchase, the value that is returned from this:

```
{exp:cartthrob:cart_discount_percent_of_total}

```

tends to differ, on my example purchases, i would get 17%, then 21% etc. I am yet to make a purchase where it had taken 20% off exactly.

Why is the `cart_discount_percent_of_total` never exactly the percent i entered when i created the coupon, which in this example is 20%? The products are high value so the a few percent could amount to hundreds of pounds.

**EE - 2.10.1**

**CT Pro - 2.7**

# Answer
I think that you may be misunderstanding the function of the tag that you are using here.

The `discount_percent_of_total` tag is calculating the discount amount in relation to the cart total amount. It is not displaying the percent off of the coupon or discount.

The following tag works inside a coupon info loop.

```
{exp:cartthrob:coupon_info}
    {coupon_percentage_off}
{/exp_cartthrob:coupon_info}

```

so if your coupon is 20 percent off, the above tag would output `20`

Please note that this tag will not work if you have a coupon set for a specific amount off a purchase. For example, I have a different coupon for ¥500 off. When I use that coupon code, the {coupon\_percentage\_off} tag is shown in the template instead of parsing out a percent. Therefore, you'll need to enclose this tag in an IF loop to prevent it displaying when there is no percent to show.

```
{if '{coupon_percentage_off}' != ''}
   {coupon_percentage_off}
{/if}

```
> 0 votes

---
Tags: cartthrob
---