title: Interspersed images and text

text:
# Question
Title: Interspersed images and text
I have a matrix in my channel fields. and a Wygwam for text. I want in the end for the content creators to be able to load images to be interspersed with the text and then as they write the text specify where said images will go.

I figure the best way to do this is to have them add a little snippet of code where they want the image to appear. But I don't really even know where to begin to build this.

Thanks

# Answer
Blocks is perfectly suited for this.

You can intersperse the content and the images right in the content field.

```
<div class="content">
{page_content}

    {simple_content}
        {content}
    {/simple_content}

    {captioned_image}
    <figure>
        <img src="{image}">
        <figcaption>{caption}</figcaption>
    </figure>
    {/captioned_image}

{/page_content}
</div>

```

Could output HTML like

```
<div class="content">
   <p>Here's some content. It comes from Wygwam or another content field.</p>
   <p>This is from the same one.</p>
   <figure>
     <img src="/image.png">
     <figcaption>This is an interspersed image.</figcaption>
   </figure>
   <p>More content.</p>
   <figure>
     <img src="/image2.png">
     <figcaption>Another interspersed image.</figcaption>
   </figure>
   <p>More content.</p>
</div>

```

Unfortunately, if all of your Matrix fields are already populated, there isn't an easy way to migrate.
> 1 votes

---
Tags: channel-entries, matrix, templates, wygwam
---


# Question
Title: Using Parameters on a Multi Channel / Channel Tag
What I am trying to accomplish is a timeline view, the timeline results are spread over multiple entries, however all of those entries are linked by a field that has a matching id.

For Example

Channel :: notes ID Field :: notes\_intake\_id

Channel :: contact\_log ID Field :: contact\_log\_intake\_id

```
{exp:channel:entries channel="contact_log|notes" search:contact_log_intake_id="={segment_4}" search:notes_intake_id="={segment_4}" dynamic="no"}
    <div class="timeline-item">
        <div class="row">
            <div class="col-xs-2 date">
                <i class="fa fa-{if "{channel_name}" == "contact_log"}comments{if:elseif "{channel_name}" == "notes"}file{/if}"></i>
                {entry_date format="%i:%g %a"}
                <br/>
                <small class="text-navy">{entry_date:relative} </small>
            </div>
            <div class="col-xs-10 content no-top-border">
                <p class="m-b-xs"><strong>{channel_name} - {title}</strong></p>
                {if "{channel_name}" == "general_release"}
                    external-link
                {if:elseif "{channel_name}" == "contact_log"}
                    comments
                {/if}
            </div>
        </div>
    </div>
{/exp:channel:entries}

```

With the search parameters i am getting no results.

Here is a screenshot of what it looks like without the search parameters. https://www.dropbox.com/s/kh5cs6ichf6f384/Screenshot%202014-11-06%2007.34.48.png?dl=0

In summary I'd like to pull channel data from multiple channels and filter them by different custom fields for each channel by the same value

# Answer
> 1 votes
Here is the solution to my question. Instead of using the search parameter i wrote a single result query around my channel entries tag and passed the concatenated entry\_id's in the entry\_id parameter Separated by | that allowed me to loop through all the entries for each channel.

```
{exp:query sql="Select GROUP_CONCAT(CONVERT(entry_id, CHAR(8)) SEPARATOR '|') as eid from exp_channel_data WHERE field_id_459 = '{embed:iid}' OR field_id_192 = '{embed:iid}' OR field_id_193 = '{embed:iid}' OR field_id_165 = '{embed:iid}' OR field_id_497 = '{embed:iid}' OR field_id_195 = '{embed:iid}' OR field_id_196 = '{embed:iid}'"}
    {if "{eid}" != ""}
    {exp:channel:entries channel="general_release|contact_log|notes|medicine_log|temperature_log|bottle_feeding_log" entry_id="{eid}" dynamic="no"}
        <div class="timeline-item">
            <div class="row">
                <div class="col-xs-2 date">
                    <i class="fa fa-{if "{channel_name}" == "general_release"}external-link{if:elseif "{channel_name}" == "contact_log"}comments{if:elseif "{channel_name}" == "notes"}file{if:elseif "{channel_name}" == "medicine_log"}medkit{if:elseif "{channel_name}" == "temperature_log"}stethoscope{if:elseif "{channel_name}" == "bottle_feeding_log"}tint{/if}"></i>
                    {entry_date format="%g:%i %a"} - {embed:iid}
                    <br/>
                    <small class="text-navy">{entry_date:relative}<br>{entry_date format="%m/%d/%Y"} </small>
                </div>
                <div class="col-xs-10 content no-top-border">
                    {if "{channel_name}" == "general_release"}
                        <p class="m-b-xs"><strong>General Release</strong></p>
                        <p>Went to {release_destination} for {if "{release_reason}" == "Other"}{release_reason_other}{if:else}{release_destination}{/if}.</p>
                    {if:elseif "{channel_name}" == "contact_log"}
                        <p class="m-b-xs"><strong>Contact</strong></p>
                        <p>Contact was made with {contact_list_relationship:contact_name}.</p>
                    {if:elseif "{channel_name}" == "notes"}
                        <p class="m-b-xs"><strong>Notes</strong></p>
                        {note}
                    {if:elseif "{channel_name}" == "medicine_log"}
                        <p class="m-b-xs"><strong>Medication</strong></p>
                        <p>{amt_given} {medication_relationship:medicine_name} were given.</p>
                    {if:elseif "{channel_name}" == "temperature_log"}
                        <p class="m-b-xs"><strong>Temperature</strong></p>
                        <p>A temperature of {temperature} was recorded.</p>
                    {if:elseif "{channel_name}" == "bottle_feeding_log"}
                        <p class="m-b-xs"><strong>Bottle Feeding</strong></p>
                        <p>A bottle was given.</p>
                    {/if}
                </div>
            </div>
        </div>
    {/exp:channel:entries}
    {/if}
    {/exp:query}

```

# Answer
> 1 votes
Without testing your code, I suspect you are getting No Results thanks to both of your search parameters needing to be found, and by definition, this is impossible, because neither channel has both of these values as fields at the same time.

This appears to be a job for Stash Lists. You can create lists with Stash, append whatever, and sort them however, including by the common field between both sets of answers. You can add both sets of channel listings to a list one at a time, naming values with new variables and mashing them up however you'd like.

Stash can be a challenge to work with if you never have worked with it before, but community support (free) and developer support (paid) is available. You may want to be sure you have the time to invest.

---
Tags: channel-entries, channel, parameters, multiple-channels
---


title: URL Redirecting Issues

text:
# Question
Title: URL Redirecting Issues
We are running expression engine v2.7.2 and the issue we seem to be having is that URLs are redirecting to the segment 2.

ex. 1 http://www.website.com/pagedoesntexist \- displays 404 error

ex. 2 http://www.website.com/page1/pagedoesntexist

I'm suspecting it might be a mod-rewrite

```
  <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]

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

```

I'm wondering what needs to change to correct it. Can maybe someone provide a working rewrite??

thanks

# Answer
> 1 votes
One quick way you can tell if it's your `.htaccess` is try updating it to the following. I got this from Nicu at EE Zoo and have been using it for all of my builds here on out:

```
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html

# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html

# Techniques in here adapted from all over, including:
#   Kroc Camen: camendesign.com/.htaccess
#   perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
#   Sample .htaccess file of CMS MODx: modxcms.com

# ----------------------------------------------------------------------
# Better website experience for IE users
# ----------------------------------------------------------------------

# Force the latest IE version, in various cases when it may fall back to IE7 mode
#  github.com/rails/rails/commit/123eb25#commitcomment-118920
# Use ChromeFrame if it's installed for a better experience for the poor IE folk

<IfModule mod_headers.c>
  Header set X-UA-Compatible "IE=Edge,chrome=1"
  # mod_headers can't match by content-type, but we don't want to send this header on *everything*...
  <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
    Header unset X-UA-Compatible
  </FilesMatch>
</IfModule>

# ----------------------------------------------------------------------
# Cross-domain AJAX requests
# ----------------------------------------------------------------------

# Serve cross-domain Ajax requests, disabled by default.
# enable-cors.org
# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity

#  <IfModule mod_headers.c>
#    Header set Access-Control-Allow-Origin "*"
#  </IfModule>

# ----------------------------------------------------------------------
# CORS-enabled images (@crossorigin)
# ----------------------------------------------------------------------

# Send CORS headers if browsers request them; enabled by default for images.
# developer.mozilla.org/en/CORS_Enabled_Image
# blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
# hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
# wiki.mozilla.org/Security/Reviews/crossoriginAttribute

<IfModule mod_setenvif.c>
  <IfModule mod_headers.c>
    # mod_headers, y u no match by Content-Type?!
    <FilesMatch "\.(gif|png|jpe?g|svg|svgz|ico|webp)$">
      SetEnvIf Origin ":" IS_CORS
      Header set Access-Control-Allow-Origin "*" env=IS_CORS
    </FilesMatch>
  </IfModule>
</IfModule>

# ----------------------------------------------------------------------
# Webfont access
# ----------------------------------------------------------------------

# Allow access from all domains for webfonts.
# Alternatively you could only whitelist your
# subdomains like "subdomain.example.com".

<IfModule mod_headers.c>
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
    Header set Access-Control-Allow-Origin "*"
  </FilesMatch>
</IfModule>

# ----------------------------------------------------------------------
# Proper MIME type for all files
# ----------------------------------------------------------------------

# JavaScript
#   Normalize to standard type (it's sniffed in IE anyways)
#   tools.ietf.org/html/rfc4329#section-7.2
AddType application/javascript         js jsonp
AddType application/json               json

# Audio
AddType audio/ogg                      oga ogg
AddType audio/mp4                      m4a f4a f4b

# Video
AddType video/ogg                      ogv
AddType video/mp4                      mp4 m4v f4v f4p
AddType video/webm                     webm
AddType video/x-flv                    flv

# SVG
#   Required for svg webfonts on iPad
#   twitter.com/FontSquirrel/status/14855840545
AddType     image/svg+xml              svg svgz
AddEncoding gzip                       svgz

# Webfonts
AddType application/vnd.ms-fontobject  eot
AddType application/x-font-ttf         ttf ttc
AddType font/opentype                  otf
AddType application/x-font-woff        woff

# Assorted types
AddType image/x-icon                        ico
AddType image/webp                          webp
AddType text/cache-manifest                 appcache manifest
AddType text/x-component                    htc
AddType application/xml                     rss atom xml rdf
AddType application/x-chrome-extension      crx
AddType application/x-opera-extension       oex
AddType application/x-xpinstall             xpi
AddType application/octet-stream            safariextz
AddType application/x-web-app-manifest+json webapp
AddType text/x-vcard                        vcf
AddType application/x-shockwave-flash       swf
AddType text/vtt                            vtt

# ----------------------------------------------------------------------
# Allow concatenation from within specific js and css files
# ----------------------------------------------------------------------

# e.g. Inside of script.combined.js you could have
#   <!--#include file="libs/jquery-1.5.0.min.js" -->
#   <!--#include file="plugins/jquery.idletimer.js" -->
# and they would be included into this single file.

# This is not in use in the boilerplate as it stands. You may
# choose to use this technique if you do not have a build process.

#<FilesMatch "\.combined\.js$">
#  Options +Includes
#  AddOutputFilterByType INCLUDES application/javascript application/json
#  SetOutputFilter INCLUDES
#</FilesMatch>

#<FilesMatch "\.combined\.css$">
#  Options +Includes
#  AddOutputFilterByType INCLUDES text/css
#  SetOutputFilter INCLUDES
#</FilesMatch>

# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------

<IfModule mod_deflate.c>

  # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
  <IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
    </IfModule>
  </IfModule>

  # Compress all output labeled with one of the following MIME-types
  <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE application/atom+xml \
                                  application/javascript \
                                  application/json \
                                  application/rss+xml \
                                  application/vnd.ms-fontobject \
                                  application/x-font-ttf \
                                  application/xhtml+xml \
                                  application/xml \
                                  font/opentype \
                                  image/svg+xml \
                                  image/x-icon \
                                  text/css \
                                  text/html \
                                  text/plain \
                                  text/x-component \
                                  text/xml
  </IfModule>

</IfModule>

# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------

# These are pretty far-future expires headers.
# They assume you control versioning with filename-based cache busting
# Additionally, consider that outdated proxies may miscache
#   www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

# If you don't use filenames to version, lower the CSS and JS to something like
# "access plus 1 week".

<IfModule mod_expires.c>
  ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.
  ExpiresDefault                          "access plus 1 month"

# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
  ExpiresByType text/cache-manifest       "access plus 0 seconds"

# Your document html
  ExpiresByType text/html                 "access plus 0 seconds"

# Data
  ExpiresByType text/xml                  "access plus 0 seconds"
  ExpiresByType application/xml           "access plus 0 seconds"
  ExpiresByType application/json          "access plus 0 seconds"

# Feed
  ExpiresByType application/rss+xml       "access plus 1 hour"
  ExpiresByType application/atom+xml      "access plus 1 hour"

# Favicon (cannot be renamed)
  ExpiresByType image/x-icon              "access plus 1 week"

# Media: images, video, audio
  ExpiresByType image/gif                 "access plus 1 month"
  ExpiresByType image/png                 "access plus 1 month"
  ExpiresByType image/jpeg                "access plus 1 month"
  ExpiresByType video/ogg                 "access plus 1 month"
  ExpiresByType audio/ogg                 "access plus 1 month"
  ExpiresByType video/mp4                 "access plus 1 month"
  ExpiresByType video/webm                "access plus 1 month"

# HTC files  (css3pie)
  ExpiresByType text/x-component          "access plus 1 month"

# Webfonts
  ExpiresByType application/x-font-ttf    "access plus 1 month"
  ExpiresByType font/opentype             "access plus 1 month"
  ExpiresByType application/x-font-woff   "access plus 1 month"
  ExpiresByType image/svg+xml             "access plus 1 month"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"

# CSS and JavaScript
  ExpiresByType text/css                  "access plus 1 year"
  ExpiresByType application/javascript    "access plus 1 year"

</IfModule>

# ----------------------------------------------------------------------
# Prevent mobile network providers from modifying your site
# ----------------------------------------------------------------------

# The following header prevents modification of your code over 3G on some
# European providers.
# This is the official 'bypass' suggested by O2 in the UK.

# <IfModule mod_headers.c>
# Header set Cache-Control "no-transform"
# </IfModule>

# ----------------------------------------------------------------------
# ETag removal
# ----------------------------------------------------------------------

# FileETag None is not enough for every server.
<IfModule mod_headers.c>
  Header unset ETag
</IfModule>

# Since we're sending far-future expires, we don't need ETags for
# static content.
#   developer.yahoo.com/performance/rules.html#etags
FileETag None

# ----------------------------------------------------------------------
# Stop screen flicker in IE on CSS rollovers
# ----------------------------------------------------------------------

# The following directives stop screen flicker in IE on CSS rollovers - in
# combination with the "ExpiresByType" rules for images (see above).

# BrowserMatch "MSIE" brokenvary=1
# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
# BrowserMatch "Opera" !brokenvary
# SetEnvIf brokenvary 1 force-no-vary

# ----------------------------------------------------------------------
# Set Keep-Alive Header
# ----------------------------------------------------------------------

# Keep-Alive allows the server to send multiple requests through one
# TCP-connection. Be aware of possible disadvantages of this setting. Turn on
# if you serve a lot of static content.

# <IfModule mod_headers.c>
#   Header set Connection Keep-Alive
# </IfModule>

# ----------------------------------------------------------------------
# Cookie setting from iframes
# ----------------------------------------------------------------------

# Allow cookies to be set from iframes (for IE only)
# If needed, specify a path or regex in the Location directive.

# <IfModule mod_headers.c>
#   Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
# </IfModule>

# ----------------------------------------------------------------------
# Start rewrite engine
# ----------------------------------------------------------------------

# Turning on the rewrite engine is necessary for the following rules and
# features. FollowSymLinks must be enabled for this to work.

# Some cloud hosting services require RewriteBase to be set: goo.gl/HOcPN
# If using the h5bp in a subdirectory, use `RewriteBase /foo` instead where
# 'foo' is your directory.

# If your web host doesn't allow the FollowSymlinks option, you may need to
# comment it out and use `Options +SymLinksOfOwnerMatch`, but be aware of the
# performance impact: http://goo.gl/Mluzd

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
  RewriteEngine On
# RewriteBase /
</IfModule>

# ----------------------------------------------------------------------
# Suppress or force the "www." at the beginning of URLs
# ----------------------------------------------------------------------

# The same content should never be available under two different URLs -
# especially not with and without "www." at the beginning, since this can cause
# SEO problems (duplicate content). That's why you should choose one of the
# alternatives and redirect the other one.

# By default option 1 (no "www.") is activated.
# no-www.org/faq.php?q=class_b

# If you'd prefer to use option 2, just comment out all option 1 lines
# and uncomment option 2.

# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME!

# ----------------------------------------------------------------------

# Option 1:
# Rewrite "www.example.com -> example.com".

<IfModule mod_rewrite.c>
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>

# ----------------------------------------------------------------------

# Option 2:
# Rewrite "example.com -> www.example.com".
# Be aware that the following rule might not be a good idea if you use "real"
# subdomains for certain parts of your website.

# <IfModule mod_rewrite.c>
#   RewriteCond %{HTTPS} !=on
#   RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#   RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# </IfModule>

# ----------------------------------------------------------------------
# Built-in filename-based cache busting
# ----------------------------------------------------------------------

# If you're not using the build script to manage your filename version revving,
# you might want to consider enabling this, which will route requests for
# /css/style.20110203.css to /css/style.css

# To understand why this is important and a better idea than all.css?v1231,
# read: github.com/h5bp/html5-boilerplate/wiki/cachebusting

# <IfModule mod_rewrite.c>
#   RewriteCond %{REQUEST_FILENAME} !-f
#   RewriteCond %{REQUEST_FILENAME} !-d
#   RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]
# </IfModule>

# ----------------------------------------------------------------------
# Prevent SSL cert warnings
# ----------------------------------------------------------------------

# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
# https://www.example.com when your cert only allows https://secure.example.com

# <IfModule mod_rewrite.c>
#   RewriteCond %{SERVER_PORT} !^443
#   RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]
# </IfModule>

# ----------------------------------------------------------------------
# Prevent 404 errors for non-existing redirected folders
# ----------------------------------------------------------------------

# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the
# same name does not exist.
# webmasterworld.com/apache/3808792.htm

Options -MultiViews

# ----------------------------------------------------------------------
# Custom 404 page
# ----------------------------------------------------------------------

# You can add custom pages to handle 500 or 403 pretty easily, if you like.
# If you are hosting your site in subdirectory, adjust this accordingly
#    e.g. ErrorDocument 404 /subdir/404.html
ErrorDocument 404 /404

# ----------------------------------------------------------------------
# UTF-8 encoding
# ----------------------------------------------------------------------

# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset utf-8

# Force UTF-8 for a number of file formats
AddCharset utf-8 .atom .css .js .json .rss .vtt .xml

# ----------------------------------------------------------------------
# A little more security
# ----------------------------------------------------------------------

# To avoid displaying the exact version number of Apache being used, add the
# following to httpd.conf (it will not work in .htaccess):
# ServerTokens Prod

# "-Indexes" will have Apache block users from browsing folders without a
# default document Usually you should leave this activated, because you
# shouldn't allow everybody to surf through every folder on your server (which
# includes rather private places like CMS system folders).
<IfModule mod_autoindex.c>
  Options -Indexes
</IfModule>

# Block access to "hidden" directories or files whose names begin with a
# period. This includes directories used by version control systems such as
# Subversion or Git.
<IfModule mod_rewrite.c>
  RewriteCond %{SCRIPT_FILENAME} -d [OR]
  RewriteCond %{SCRIPT_FILENAME} -f
  RewriteRule "(^|/)\." - [F]
</IfModule>

# Block access to backup and source files. These files may be left by some
# text/html editors and pose a great security danger, when anyone can access
# them.
<FilesMatch "(\.(bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$">
  Order allow,deny
  Deny from all
  Satisfy All
</FilesMatch>

# If your server is not already configured as such, the following directive
# should be uncommented in order to set PHP's register_globals option to OFF.
# This closes a major security hole that is abused by most XSS (cross-site
# scripting) attacks. For more information: http://php.net/register_globals
#
# IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS:
#
# Your server does not allow PHP directives to be set via .htaccess. In that
# case you must make this change in your php.ini file instead. If you are
# using a commercial web host, contact the administrators for assistance in
# doing this. Not all servers allow local php.ini files, and they should
# include all PHP configurations (not just this one), or you will effectively
# reset everything to PHP defaults. Consult www.php.net for more detailed
# information about setting PHP directives.

# php_flag register_globals Off

# Rename session cookie to something else, than PHPSESSID
# php_value session.name sid

# Disable magic quotes (This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.)
# php_flag magic_quotes_gpc Off

# Do not show you are using PHP
# Note: Move this line to php.ini since it won't work in .htaccess
# php_flag expose_php Off

# Level of log detail - log all errors
# php_value error_reporting -1

# Write errors to log file
# php_flag log_errors On

# Do not display errors in browser (production - Off, development - On)
# php_flag display_errors Off

# Do not display startup errors (production - Off, development - On)
# php_flag display_startup_errors Off

# Format errors in plain text
# Note: Leave this setting 'On' for xdebug's var_dump() output
# php_flag html_errors Off

# Show multiple occurrence of error
# php_flag ignore_repeated_errors Off

# Show same errors from different sources
# php_flag ignore_repeated_source Off

# Size limit for error messages
# php_value log_errors_max_len 1024

# Don't precede error with string (doesn't accept empty string, use whitespace if you need)
# php_value error_prepend_string " "

# Don't prepend to error (doesn't accept empty string, use whitespace if you need)
# php_value error_append_string " "

# Increase cookie security
<IfModule php5_module>
  php_value session.cookie_httponly true
</IfModule>

# ExpressionEngine Rewrite

<IfModule mod_rewrite.c>
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond $1 !.(\.css|\.js|\.png|\.jpe?g|\.gif|\.ico)$ [NC]
  RewriteRule ^(.+)$ index.php/$1 [L]
</IfModule>

```

This is the first thing I update whenever I inherit a site and looking to optimize it :) Hopefully you find it as helpful as I have!

---
Tags: htaccess, redirects, 404
---


# Question
Title: If statement failing in with custom field on a specific post with certain value length
A very weird problem, but in a specific channel that has many custom fields I get a very peculiar problem with just one entry (as far as I can tell) where a particular custom field is failing only inside an `if` statement. Example:

```
{if my_custom_field}
  {my_custom_field}
{/if}

```

This causes the entire template to fail, resulting in a white screen. I've switched on every form of debugging (index file and admin area). There are no errors.

If I remove the `if` statement and simply output the field, it works fine. If I empty the field it works fine. If the field has only up to ~67 characters in it, it works fine.

Please bear in mind, this is only a problem with ***this*** entry; other entries don't experience this issue.

Things I've tried:

* Creating a new entry with the same data
* Rewriting the content of this field by hand (not copy-pasting in case of a malformed character)
* Renaming the custom field
* Adding the same content to a different field
* Reducing the number of `if` statements in the template
* Increasing the memory available to PHP

So my question really is: has anyone ever come across this before? Where can I look to solve it?

# Answer
> 0 votes
It could just be a quote or other glyph in the field which terminates the conditional early.

I wrote a little add on which might help you here. It will return the length of a given field so you can run your conditional check on that number rather than using the entire field contents.

---
Tags: templates, conditionals, custom-fields
---


# Question
Title: How to set default values for layout variables?
I'd like to set some default values for several layout variables, for when a particular template doesn't have a need to pass a specific variable to the parent layout. For example, I set my page's "description" meta tag via a layout variable, but some pages don't need a unique description - they should just use a "global" description. Setting defaults would save a lot of extraneous code in each template.

I tried doing a conditional check in my layout template:

```
{if layout:description == ''}
    {layout:set name="description" value="My default site description."}
{/if}

```

But that doesn't work, because `layout:set` tags are not parsed inside layout templates.

How can I set defaults?

# Answer
> 3 votes
The key here is in looking at the template engine order of operations. You can see that snippets are processed very early on. It also so happens that if you set a layout variable multiple times, it's the last value which remains.

So you can create a snippet which sets default for all of your metadata, then include that snippet alongside your layout tag in all your templates. Then, call `{layout:set}` for only the variables you need to change per-template.

### Template

```
{layout="_global/_layout"}
{sn_default_metadata}

<p>Hello world.</p>

```

### Layout file (\_global/\_layout)

```
<!DOCTYPE html>
<html lang="{lang}">
<head>
    <meta charset="{charset}" />
    <meta name="description" content="{layout:description}" />
    <meta name="thumbnail" content="{layout:thumbnail}" />
    {if layout:robots}<meta name="robots" content="{layout:robots}" />{/if}

    <meta property="og:title" content="{if layout:title}{layout:title}{if:else}{layout:site_name}{/if}" />
    <meta property="og:description" content="{layout:description}" />
    <meta property="og:image" content="{layout:thumbnail}" />
    <meta property="og:url" content="{layout:url}" />
    <meta property="og:type" content="{layout:open_graph_type}" />

    <title>{if layout:title}{layout:title} – {/if}{layout:site_name}</title>
</head>
<body>

    {layout:contents}

</body>
</html>

```

### Snippet ({sn\_default\_metadata})

```
{layout:set name="description" value="My default site description."}
{layout:set name="open_graph_type" value="website"}
{layout:set name="site_name" value="My Great Website"}
{layout:set name="thumbnail" value="{site_url}/assets/img/thumbnail.png"}
{layout:set name="url" value="{current_url}"}

```

## Template with overrides

```
{layout="_global/_layout"}
{sn_default_metadata}

{exp:channel:entries channel="news" limit="1"}
    <h1>{title}</h1>
    <img src="{news_image}" alt="" />
    {news_body}

    {layout:set name="title" value="{title}"}
    {layout:set name="description" value="{news_summary}"}
    {layout:set name="url" value="{title_permalink="news/entry"}"}
    {layout:set name="thumbnail" value="{news_image}"}
    {layout:set name="open_graph_type" value="article"}
{/exp:channel:entries}

```

---
Tags: template-layouts, layout-variables
---


# Question
Title: P&T Field Pack 2.1.1 on EE2.8.1: error on specific Checkbox field only
I've read P&T Field Pack 2.1.1 on EE2.8.1 Installation Errors Notice and warnings so I'm aware of that.

What I have is several Field Pack **Checkbox** fields across more than one site in an MSM installation, all of which seem to be behaving just fine: both in terms of output and field settings editability, except for one…

**One field only** is generating wrong output, and PHP errors if I try to edit the field.

```
Message: Undefined index: field_fmt_options
Filename: fieldtypes/EE_Fieldtype.php
--
Message: Invalid argument supplied for foreach()
Filename: helpers/form_helper.php

```

Which seems odd. Can't see anything in the DB so far to hint at why. It would make more sense to me if **all** the PT checkbox fields were issuing the same errors.

Anyway, I guess P&T FieldPack is dying a slow death? What alternatives do people recommend?

# Answer
That’s an EE core file, not a Field Pack file. Try updating EE and see if that helps. If not, please get in touch with us at support@pixelandtonic.com and we can try to look into it from there.
> 0 votes

---
Tags: pixelandtonic, field-pack, checkbox, pt-checkboxes
---


# Question
Title: How to remove sub-items from a Structure navigation item?
I am completely new to Expression Engine and I am trying to reverse engineer a site that someone else built. From what I understand, there is a plugin called "Structure" which controls the main navigation of the site.

```
{exp:ce_cache:escape}
    {exp:ce_cache:it:nested id="topnav" global="no" seconds="3600"}
        {exp:structure:nav start_from="/" show_depth="2" max_depth="2" add_unique_ids="yes" css_class="topnav" css_id="none" current_class="current" include="3|4|5|17|18" exclude="10"}
    {/exp:ce_cache:it:nested}
{/exp:ce_cache:escape}

```

There is a navigation item which contains too many sub-items (which results in a really long drop-down), so my task is to hide the sub-items while keeping the page that they link to. I went to the "Structure" section of admin and only found the ability to delete pages.

How can I hide the drop-down for this particular nav item?

# Answer
I learned that the Structure plugin does not provide a way of controlling the depth of an individual navigation item, so I came up with a hack to address this issue. By using a little bit of Javascript, I am removing the subnav/dropdown `<ul>`:

```
<script type="text/javascript">
  var ul = document.getElementById('my-nav-item').getElementsByTagName('ul')[0];
  ul.parentNode.removeChild(ul);
</script>

```
> 0 votes

# Answer
If I am understanding you, you would like to hide all the subitems and keep the main navigation unchanged? This can be done by changing show\_depth="2" to show\_depth="0". That way all you will see is the main navigation and there will no longer be a dropdown for the subitems.

```
{exp:ce_cache:escape}
    {exp:ce_cache:it:nested id="topnav" global="no" seconds="3600"}
        {exp:structure:nav start_from="/" show_depth="0" max_depth="2" add_unique_ids="yes" css_class="topnav" css_id="none" current_class="current" include="3|4|5|17|18" exclude="10|#|#|#|#"}
    {/exp:ce_cache:it:nested}
{/exp:ce_cache:escape}

```
> 0 votes

---
Tags: structure, navigation
---


# Question
Title: How to hide content if channel has no entries?
A found a few questions related to this one. However, the solution they provide is not compatible with my situation.

I have a set of tabs which act as filters for displaying content.

```
<ul id="tabs">
  <li><a href="#tab-approved">Approved</a></li><!-- only display if channel has entries -->
  <li><a href="#tab-pending">Pending</a></li>
</ul>

<div id="tab-approved">
  {exp:channel:entries channel="thing" search:thing_status="approved"}
    ...
  {/exp:channel:entries}
</div>

...

```

How can I only display the tab if there are entries which match the search filter?

# Answer
> 0 votes
I found a way to achieve what I wanted, though the solution may not be the best practice. By adding `limit="1"` I could enforce that the loop is only run once and I can check if there is greater than zero:

```
    <ul id="tabs">
      {exp:channel:entries channel="thing" dynamic="no" search:thing_status="not approved|pending" limit="1"}
        {if count > 0}
          <li><a href="#tab-operating">Operating</a></li>
        {/if}
      {/exp:channel:entries}
      {exp:channel:entries channel="thing" dynamic="no" search:thing_status="approved" limit="1"}
        {if count > 0}
          <li><a href="#tab-approved">Approved</a></li>
        {/if}
      {/exp:channel:entries}
      {exp:channel:entries channel="thing" dynamic="no" search:thing_status="pending" limit="1"}
        {if count > 0}
          <li><a href="#tab-pending">Pending</a></li>
        {/if}
      {/exp:channel:entries}
    </ul>

```

I also added a style of `display: none` on the tabs so that even if there were no results, the tab would be hidden until the user clicked on the nav link.

# Answer
> 4 votes
Put the div tags inside your channel entries tag pair but to prevent them being output many times wrap them in conditionals. Then you can test the total results returned to decide whether to output your tab.

```
  {exp:channel:entries channel="thing" search:thing_status="approved"}
    {if count==1}
        <ul id="tabs">
          {if total_results>0}<li><a href="#tab-approved">Approved</a></li>{/if}
          <li><a href="#tab-pending">Pending</a></li>
        </ul>
        <div id="tab-approved">
    {/if}
    ...
    {if count==total_results}</div>{/if}
  {/exp:channel:entries}

```

---
Tags: conditionals
---


# Question
Title: EE 2.8.1 Search. The action you have requested is invalid
I'm trying to get a simple search form to work. But I get an error: The action you have requested is invalid.

I have no idea what I'm missing here.

Stash partial with search form:

```
<section>
            {exp:search:simple_form channel="blog" search_in="everywhere" result_page="blog/search"}
            <h2><label for="search">Search</label></h2>
            <div class="searchField">
                <input type="text" name="keywords" id="search" value="" size="18" maxlength="100">
                <button type="submit">Go!</button>
            </div> <!-- /.searchField -->
            {/exp:search:simple_form}
        </section>

```

Stash viewmodel for search results:

```
{stash:embed:layouts:blog}

{exp:stash:set name="body_class"}blog{/exp:stash:set}

{exp:stash:set_list name="detail_data" parse_tags="yes" parse_depth="2"}

    {exp:search:search_results}

        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {stash:excerpt}{excerpt}{/stash:excerpt}
        {stash:author}{author}{/stash:author}
        {stash:post_date}{entry_date format='%M %d, %Y'}{/stash:post_date}

    {/exp:search:search_results}

{/exp:stash:set_list}

```

This makes no difference. /*TEMP*/ $config\['secure\_forms'\] = "n";

I hope someone can help me out! Thanks!

# Answer
Newer versions of ee have more strict security requirements for post data. Try adding the following to your form:

```
<input type="hidden" name="XID" value="{XID_HASH}" />

```

*(This is an older question but I am adding this as it a common resolution to these sorts of problems.)*
> 1 votes

# Answer
Have you installed the "Search" add-on?

Had the same issue, but the search module wasn't installed.
> 0 votes

# Answer
I had a very similar issue, and it seemed to amount to the `{exp:search:search_results}` tag being inside a Stash tag.

So I flipped it inside out and used `{exp:stash:append}`(or append\_list in your case) inside of the search\_results tag.
> 0 votes

---
Tags: search, 2.8
---


# Question
Title: How to fix depreciation issues after upgrades
I'm still new to EE and am trying to upgrade a site from 2.6.1 to 2.8.1, but getting various errors, which I believe are all related to certain add-ons. Here's a couple examples:

Champaign2: Fatal error: Call to undefined method EE\_Fieldtype::EE\_Fieldtype() in /system/expressionengine/third\_party/champagne/ft.champagne.php

Structure: Deprecated function add\_to\_head() called in system/expressionengine/third\_party/structure/mcp.structure.php on line 213

Am I right in thinking it's down to the developers to fix these issues as EE depreciates various functions - so I need to get in touch with their support? Or is it normal for devs to struggle through one issue at a time trying to update the third-party module's code to solve themselves?

Also, are the notices in the developer logs just notices of *future* depreciations? Or do these logs indicate an actual broken function within the current version?

Thanks, Justin

# Answer
Upgrading EE is isn't always the smoothest, but yes you need to ensure all your add-ons have been upgraded by their devs to support the latest version and you should update all your add-ons before updating EE.

Whether new or not to EE, the ***Lamplighter*** add-on is a must have, providing an at-a-glance view of what add-ons are current or need updating: http://devot-ee.com/add-ons/lamplighter

Finally, DevDemon's ***Updater*** add-on is great for speeding up the update process with EE to just a few clicks: http://www.devdemon.com/expressionengine-addons/updater
> 1 votes

# Answer
In the case of Structure you should just be able to update to the recent version which I believe works fine with 2.8.1.

I'm not so sure about Champagne but it's likely the most recent version will work at least enough to allow you to remove it. Check their support as even if there isn't a working release version there is highly likely to be a quick patch you cam make to the current version.
> 0 votes

---
Tags: add-on, ee2-upgrades, developer-log
---


title: EE Session and cURL

text:
# Question
Title: EE Session and cURL
Is it possible to retain the EE session when accessing a url in the same domain via cURL?

This is because the page accessed in the cURL call is dependent on EE's session variables.

# Answer
So far as I'm aware you will need to do something special, Max alluded to being able to set a cookie. Without doing so your cURL request is seen as a totally separate session since it's initiated by your server, not by your browser.
> 1 votes

# Answer
This my be useful to you, it describes how to use cURL with session cookies

https://stackoverflow.com/questions/13020404/keeping-session-alive-with-curl-and-php
> 1 votes

---
Tags: sessions, curl
---


# Question
Title: Assets v2.4 producing error when saving an entry after upgrade from EE v2.4 to EE v2.9
I've recently performed an update of both Assets (v1.x to v2.4) and EE (v2.4 to v2.9) and now I'm seeing the following error/s when I try to save an entry in the EE control panel.

```
A PHP Error was encountered
Severity: Notice
Message: Undefined index: entry_id
Filename: assets/ft.assets.php
Line Number: 2214

A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /path/to/system/codeigniter/system/core/Exceptions.php:170)
Filename: core/EE_Input.php
Line Number: 212

A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /path/to/system/codeigniter/system/core/Exceptions.php:170)
Filename: libraries/Functions.php
Line Number: 447

```

This error appears to relate to the recent function added to Assets v2.4 to support adding data into third party search indexes.

Would really appreciate some quick help from Pixel and Tonic for this.

Thanks Brendan

# Answer
I'm using SuperSearch and getting the same issue, it appears that 'entry\_id' is no longer being set in the settings array.

I've fixed/patched for now by simply replacing line 2214 in the `third_party_search_index()` function which was

```
$entry_id = $this->settings['entry_id'];

```

To become:

```
$entry_id = ee()->api_channel_entries->entry_id;

```
> 2 votes

---
Tags: assets, pixelandtonic, 2.8, 2.9
---


# Question
Title: How can I get weblog:entries to return all values
I have this code in a template:

```
<select id="field_id_43" name="field_id_43">
    <option value="" >No related Listing</option>
    {exp:weblog:entries weblog="listings" dynamic="no" status="not closed" orderby="title" sort="asc"}
        <option value="{entry_id}" >{title}</option>
    {/exp:weblog:entries}
</select>

```

The number of items returned in the dropdown seems to be limited in some way in that the dropdown is only poputlated with listings from the letter "A" up to the letter "H".

How do I make sure that the dropdown returns ALL listings and not just a certain number of them. Where is this limit set?

# Answer
> 2 votes
The default number of entries returned by exp:weblog:entries is limited to 100. You can set a limit parameter to whatever you like and over-ride this limit.

```
{exp:weblog:entries weblog="listings" dynamic="no" status="not closed" orderby="title" sort="asc" limit="400"}

```

Be aware that there is a also chance you may run into memory and performance problems since EE will pull ALL the field data for each entry even though you are only displaying a single field.

You may be better off using a custom query, however, since you're using EE1 I'm not sure how you would do this.

---
Tags: ee1, entries, status
---


title: Freeform Pro upgrade failing

text:
# Question
Title: Freeform Pro upgrade failing
I'm mid upgrade of an EE 1.6.7 install with Freeform Pro 2.7.2. I have completed upgrading the site to 2.8.1( I know 2.9.x exists...), and now when I try to update Freeform to 4.1.8, nothing is happening.

I've copied in the new folders, gone into the Add-Ons / Module screen and ran the "Update Modules" function. Freeform then shows an updated version number to 4.1.8. Then when I go into Freeform itself, the tool works, but I have no forms showing, nor any fields. When I go into utilities, it gives me the option of migrating old collections, which I initiate, only it stalls out at "Migrating 0/9128.

\*UPDATE

I followed the direction given in this post: Solspace Freeform Pro no field types available for adding in the missing freeform fields table, which fixed that portion, along with freeform now showing all of my previous fields from before the upgrade, so that's working now.The only thing left is the migration of collections are still failing and the forms tab is still blank... even though there should be forms.

In looking further into the DB, which is getting in over my head, the Freeform upgrade renamed the original table exp\_freeform\_entries, to exp\_freeform\_entries\_legacy, then created a new exp\_freeform\_entries\_1, but seems to never have actually converted any of the data or columns from \_legacy into \_1. Is there a way to run a SQL query to do that? Like I said, it's over my head at this point...

# Answer
> 2 votes
This has been mentioned a number of times by a number of developers, but it's worth mentioning here again, as it's important:

> ★ When upgrading from EE1 to EE2, **always upgrade add-ons first, as far as possible, while still on EE1**, *then* upgrade to EE2. ★
>
> (*Then, if some add-ons have further EE2 versions, continue and complete updating the add-ons once on EE2.*)

Freeform 2.x (which is more than 5 years old as of this writing) is an EE1-only add-on, with a database schema that Freeform 4.x, which is EE2-only, cannot read. The best method is to upgrade Freeform 2.x to 3.1.5 (the last version for EE1) while still on EE1, then upgrade EE2.

Then, complete the update Freeform to version 4.x.

---

The other option is to start fresh with Freeform 4.x on your now EE2 setup.

---
Tags: solspace-freeform
---


# Question
Title: Super Search Questions - Partial search_words_within_words, Empty Search Strings, Single Search Result Redirect (SOLVED)
On the website http://constructionbook.bnibooks.com/, I'm trying to modify Super Search to get search on the website the way we want it, but I'm having some difficulties.

Super Search Version 2.1.4, Expression Engine Version 2.8.1

**1. 'NO SOLUTION'** Is there a way to have the parameter search\_word\_within\_words apply to some searchable fields but not to others?

**2. 'SOLVED'** In order to make it so that an empty string returns no search results, I tried adding the conditional statement:

```
        {if super_search_keywords==""}
            <div class="col-md-12">
                <p>No results matched your query.</p>
            </div>
        {/if}

```

However, any empty search string still paginates and now returns "No results matched your query." 4 times (with a long empty space in between time). I believe this is because it hasn't actually stopped displaying any products. How might I change the results so that if the search string is empty, we simply return 0 results?

**3. 'SOLVED'** Is there a way to, if super\_search\_total\_results is equal to 1, redirect the user to the page for that result. In other words, there's only one result, so they should be take to that page. I have the conditional statement:

```
        {if super_search_total_results==1}

        {/if}

```

But I'm not sure what code to put in that statement that will redirect to the result. What might I write that would redirect the user to that page?

*Edit: I was able to take care of #3 with a redirect tag that is built into ExpressionEngine*

**4. SOLVED** On our old website, we had it set up so that some searches redirected to category pages. We have a large number of categories, so it would be impractical to simply write an {if} statement for each one.

Is there a way we can build a table and have super search read that table, so that if a user searches a specific term, we can redirect them to a specific category page?

*Edit: I was able to take care of #6 with URL redirects using Detour Pro*

# Answer
> 0 votes
1. Unfortunately that isn't possible unless you use the `search_in=""` parameter (http://www.solspace.com/docs/super\_search/results/#search\_in), but `search_word_within_words` would still apply to all fields mentioned in `search_in`.
2. To avoid displaying "*No results matched your query.*" 4 times, try putting the `{if super_search_keywords==""}...{/if}` conditional **outside** of `{exp:super_search:results}`.

Also, try wrapping the code inside `{exp:super_search:results}` with `{if super_search_keywords != ""}...{/if}` so that **1.** results display only if `keywords` is filled out and **2.** nothing displays when `keywords` is empty (by default Super Search would return entries otherwise)

---
Tags: solspace, search, supersearch
---


# Question
Title: FieldFrame fieldtype errors after upgrading from EE1 to EE2
I've recently upgraded from EE1 to EE2. I had some issues with upgrading the add-ons which you can see here, but I now have a working cpanel that I am able to log into, but on the frontend I am getting this error:

```
Error

Unable to load requested field type file:  ft.ftype_id_2.php.

Confirm the fieldtype file is located in the expressionengine/third_party/ directory

```

I have done a search for ftype\_id\_2 in my database and it returned 3 results from the exp\_channel\_fields table. On the EE1 version of the site these are all FreeForm fields "FF Checkbox Group"

How should I proceed to get these fields across from EE1 to EE2?

# Answer
> 0 votes
FieldFrame doesn't exist anymore. It was replaced by Pixel & Tonic Matrix.

There's some update instructions on their website.

---
Tags: ee2, fieldtype, ee1, upgrade
---


title: MX Cloner "not authorized" error

text:
# Question
Title: MX Cloner "not authorized" error
Using MX Cloner (v 1.2.4) with EE 2.9.2 I get this error when saving a "cloned" entry:

"You are not authorized to perform this action"

From what I can tell, this only happens when the entry has a "Grid" element in it. The entry looks good, but just won't save. I'm logged in as the admin user.

Any ideas?

# Answer
Version 1.2.5 is available for download.

Grid field has new methods for fields validation which asked for new way to do entry clone. I hope that new update helps you.
> 3 votes

---
Tags: mx-cloner
---


# Question
Title: Relationship field lookup in an EE plugin?
I'm in the unfortunate position of needing to fix a third-party plugin that was created under contract; the original developers are not available to fix it.

From within the plugin, I'll need to look up field data from a relationships field. e.g.: "shirts" has a relationship field that points to the "vendors" channel, which contains a field "email", so in php using the EE classes or raw SQL, I'd need to look up:

shirts-\>vendors-\>email

After a bit of Google'ing, I didn't find anything documenting the internal structure of relationship fields, or how this might be accomplished.

Any help would be appreciated!

# Answer
> 1 votes
You may need to query the `exp_relationships` table directly. It uses a lot of ids, so you'll have to know them in advance, but from your requirements, it sounds like that shouldn't be a big deal.

---
Tags: relationships, database, plugin
---


# Question
Title: <iframe> embed being stripped from rich text field
I have a wygwam rich text area field, and when I switch to the "Source" view, paste in a standard embed snippet from Vimeo, then switch back to the HTML view, the snippet is immediately deleted. Before I save the page or do anything else, simply by changing views. If I try saving before switching back to HTML view, the is also deleted.

How do I prevent wygwam from deleting my vimeo code?

# Answer
This is because the you have "Restrict allowed HTML" set to YES for your field's WYGWAM configuration. Change **Restrict allowed HTML** to "**NO**" and it should work how you want.
> 2 votes

---
Tags: wygwam
---


# Question
Title: Solspace tag display all available tags from a channel and related tag group
I have a template which displays all products (entries) for a particular channel:

```
Viewing all entries tagged with:<br>
{exp:channel:entries channel="products" category_group="1" category="not 7|8|9" status="retail|showroom|open" dynamic="no" orderby="title" sort="asc"}
        {exp:tag:tags entry_id="{entry_id}" backspace="2" tag_group_name="Attributes" orderby="tag_name" sort="desc"} {tag} |{/exp:tag:tags}
{/exp:channel:entries}

{exp:channel:entries channel="products" category_group="1" category="not 7|8|9" status="retail|showroom|open" dynamic="no" orderby="title" sort="asc" limit="8" paginate="bottom"}

<!-- all the sauce to display product entry -->

{switch='|||</div><div class="row row-category">'}{snp_paginate} {/exp:channel:entries}

<div class="row" style="text-align: center; margin-bottom: 10px;"> {exp:stash:get name='pagination_links' random limit="1" process="end"} </div>

```

but that is not working in a way I expect (some tags are displayed multiple times).

At that point my question is how can I get to display all tags (but not doubles) assigned to products (displayed using template above) from particular tag group?

Also is there any way to create something similar what NewEgg has on a left side bar, where customer can select "tags" and display only products which has those tags assigned?

# Answer
> 0 votes
To get tags for specific entries in one list, and without tags being repeated, `{exp:tag:cloud}` can't be used because there is no `entry_id=""` parameter. Further, the `tag_group_id=""` would list all tags in a tag group, not further filtered by specific entries.

Because `{exp:tag:tags}` is repeated at each `{exp:channel:entries}` loop, chances are you get duplicates of some tags. You'll need to create an array of unique tags to filter out duplicates. One way to do this is with PHP.

Enable PHP in your Templates and set it to *Output*. Then create your array:

```
{!-- Start with an empty array --}
<?php $tags = array(); ?>

{exp:channel:entries /* your parameters */}
   {exp:tag:tags entry_id="{entry_id}"}
      {!-- add the tag to the array. Duplicate tag_ids will be filtered this way --}
      <?php tags['{tag_id}'] = '{tag_name}'; ?>
   {exp:tag:tags}
{exp:channel:entries}

```

Now you `$tags` array should have unique keys (the tag\_id), and therefore tag\_names should be unique as well. Finally, simply loop through the unique list of tags outside of and after {exp:channel:entries}. Below we're building a comma-separated list first, then trimming the final comma. Finally, we output the final string:

```
{!-- Start with an empty string --}
<?php $tag_list = ''; ?>

<?php foreach($tags as $tag) :?>
   {!-- Concatenate tags --}
   <?php $tag_list .= $tag . ", "; ?>
<?php endforeach ?>

{!-- Trim the final extra comma and display to screen --}
<?php echo rtrim($tag_list, ", "); ?>

```

There are likely other ways to do this, using Stash perhaps, but this uses native tools.

---
Tags: channel-entries, channel, tags, solspace-tag
---


title: Expresso-store: Non integer price value

text:
# Question
Title: Expresso-store: Non integer price value
I want to display some of my items with an non integer price value in Expresso Store. For instance, display some of the items with the price value of 'Request price'.

Is this possible in Expresso Store, and if so, how?

# Answer
I would set the quantity of those items to 0 (unavailable) and use a standard EE conditional to show a "Request Price".
> 1 votes

---
Tags: expresso-store
---


# Question
Title: How can we add custom column in control panel for any channel entry
How can we add custom column in control panel (EE verstion 2.9.2) content \>\> Edit for any channel entry?

# Answer
> 6 votes
If you want a whole lot more control over column display in the channel \> edit area, you should look at the add-on Zenbu. It will allow you to customize the way channel entry content is displayed in the control panel, per channel, and per member group.

(If on the other hand you need to display some content that isn't in the channel entries in a column, I don't have a quick answer for you!)

---
Tags: channel-entries, control-panel
---


title: Private Downloads page

text:
# Question
Title: Private Downloads page
I'm attempting to make the following scenario in EE *without* utilizing membership. A form is on page 1. Upon successful submission of form, user is taken to page 2 which contains content only accessible after form is filled out. More than likely using FreeForm for my form submissions. The purpose of this is to just gather information about the people wanting the form-blocked content.

I'm just trying to wrap my head around how to do this without someone being able to hack the url to page 2...ie..

page 1 form would be at:

domain.com/form

upon successful submit, would be directed to page 2:

domain.com/form/content

Can anyone think of a different or better way of handling this so that the url cannot be hacked? Membership seems like the obvious choice, but some of these users will potentially already be members of a different group, some may not. Thanks for any help!

# Answer
> 0 votes
You can allow page access with members by using conditionals to test if the person is in member group 1 or 2. I'd definitely go the Members route. The only other way to block a page is to use .htpassword but then users would still need a way to "login" to view the page.

---
Tags: forms, content
---


# Question
Title: EE url for news (like /news/2014/11/title for news)
Cant find how to do url for all news like this

http://example.com/news/**year/month/day**/title\_for \_news

Now my current news have url http://example.com/news/title\_for \_news/

# Answer
If you are using EE v2.8 or higher, you can use the built in Template Routes feature for this.

For your individual entry template, add a routing rule for that template in Design \> Template Manager \> Template Route Manager like this:

```
/news/{year:regex[(\d{4})]}/{month:regex[(\d{2})]}/{day:regex[(\d{2})]}/{news_title:alpha_dash}

```

I'm using the "Segments Required" set to "Yes" so that URLs without the url title like `example.com/news/2014/` will default back to the `news/index` template.

Then your channel entries tag might look something like this:

```
{exp:channel:entries
  channel="news"
  limit="1"
  url_title="{segment:news_title}"
  dynamic="no"
}

```

The year, month, and day segments aren't used by the channel entries tag at all. In fact, you can enter the wrong day, month, or year in the URL and it would still pull up the correct entry. The upside of this is that if you change the entry's date, old links to this article will still work.

If you want the URL to be more strict, you could add the year, month and day parameters to the channel entries tag like this:

```
{exp:channel:entries
  channel="news"
  limit="1"
  url_title="{segment:news_title}"
  year="{segment:year}"
  month="{segment:month}"
  day="{segment:day}"
  dynamic="no"
}

```

Take a look at the ExpressionEngine User Guide on Template Routes for more information. EllisLab also has a nice blog post about how template routes can be used here: Template Routes in ExpressionEngine 2.8

If you're running EE v2.7.3 and lower, you could use segment variables in a single template.

It would use a "news/index" template and the route would look like this essentially:

```
/news/{segment_1/{segment_2}/{segment_3/{segment_4}

```

Use a conditional to show either and entry or a listing:

```
{if segment_4}

  {!-- New entry code here --}
  {exp:channel:entries
    channel="news"
    limit="1"
    url_title="{segment_4}"
    year="{segment_1}"
    month="{segment_2}"
    day="{segment_3}"
    dynamic="no"
  }

{/if}
{if segment_4 == ''}

  {!-- New listing code here --}
  {exp:channel:entries
    channel="news"
    limit="10"
  }

{/if}

```

NOTE: I'm using 2 simple conditions instead of {if:else} because that would make it an advanced conditional and the parse engine would parse both channel entries tags regardless of which one is needed. This wouldn't be needed in EE v2.9 or later tho as they changed how the Conditional Parser works.
> 2 votes

# Answer
A few questions regarding your URL design:

* What happens when `title_for_news` is a valid url\_title, but it was published on a different year/month/day? 404?
* Do you return something reasonable for `/news/year/month/day`? `/news/year/month`? `/news/year`? In good URL design, removing segments from a valid URL gives you another valid URL.

If you have a good plan in place for those situations, your best bet is probably Resource Router.

```
$config['resource_router'] = array(
    'news/:year' => 'news/filtered-by-year',
    'news/:year/:month' => 'news/filtered-by-month',
    'news/:year/:month/:day' => 'news/filtered-by-day',
    'news/:year/:month/:day/:url_title' => 'news/item'
);

```

You may also want to take pagination into account with the `:pagination` URL parameter.
> 0 votes

---
Tags: ee2
---


# Question
Title: How do I use a SAEF / Channel Form to upload a file not related to entry?
Is there any way to use a SAEF / Channel Form to upload an image (with title, category etc.)?

Will it require a custom plugin or is this something that can be achieved already?

Thank you.

# Answer
> 0 votes
The SAEF does just what it says - creates new entries from outside the Control Panel. You could look to use Solspace Freeform to create a form that allows image uploads outside of Channel:Entries.

Alternatively you could just dedicate a channel for your file uploads if you want to assign meta data to each image.

---
Tags: safecracker, file-uploads, files, safecracker-file
---


# Question
Title: Can I edit contents of Channel Files field in Safecracker Form?
Can I build a page with SafeCracker that will allow me...

1) Upload files via Channel Files field? I'm running EE 2.5.5 (SafeCracker 2.1).

2) Manage (Edit, Delete, Add) files already previously submitted?

I wasn't able to find much info on the second question.

# Answer
Yes, Channel Form (Safecracker) is supported. You can upload files and edit/delete/add them just like your CP publish form.

Brad
> 0 votes

---
Tags: safecracker, devdemon, channel-files
---


# Question
Title: Working with PHP variables between templates
What is the best way to "send" a PHP variable between templates? I have an array `$myArray` that I create in my `index.html` template. Then I have a template which goes to fetch data from an external API, and store the items in `$myArray`. And then I've turned on caching for this template, so I won't have to churn through the API request on every load. Then back at the `index.html` I want to output stuff from `$myArray`.

Basically it would look something like this:

```
//index.html:
<?php global $myArray; ?>
{embed="include/api"}
<?php
foreach ($myArray as $m) {
    //output
} ?>

//api.html:
global $myArray;
$myArray = getAPIdata(); //getAPIdata just fetches stuff and returns the array

```

Now, this doesn't work of course. But I don't know why. And I don't have any other ideas on how to accomplish this. Especially since I want caching on my `api.html` template.

# Answer
> 1 votes
Don't ever enable php in a template. Aside from being a security risk it's also just ugly and hard to maintain.

Take some time to learn how to build your functionality as an add-on. Plugins are the simplest type of add-on to get started with: https://ellislab.com/expressionengine/user-guide/development/index.html

In terms of the specifics of saving data across page loads, take a look at the session class

---
Tags: php
---


# Question
Title: Possible to associate/include image with channel field?
I'm fairly new to EE and currently familiarizing myself with the channels/fields process, and I'm wondering if there's a way-- either natively or with the help of an add-on-- to associate an image or provide a choice of images when publishing via a specific channel?

To provide some context, I have a basic new type feed that displays various events in order of date in a sidebar. The provided channel fields will include event name, date and location. To the side of each entry, I would like to display an image that is specific to that location-- i.e. if a user wants to publish an event that will take place in Chicago, an image specific to that city will show next to the event details text. I realize that I could provide a field for the user to upload an image each time, but given that the range of cities will be finite, I'd like to provide the images beforehand, and either allow the user to select the image appropriate to the given city, or somehow have that image displayed in the corresponding `div` that is associated with the specific city that is selected/entered into the "city" field.

Is this possible? Please let me know if my question is unclear in any way. Thanks for any assistance here.

# Answer
> 0 votes
Sounds like you are not sure yet how you are structuring your site in terms of selecting the city, so here are a couple options:

If your location choices are based on a category, you can use a category image, but that would limit the pic to a default one you setup (So every Chicago event has the same pic): https://ellislab.com/expressionengine/user-guide/cp/admin/channels/category\_create.html

If you really want the user to have options from a set gallery, you could look through Dev Demons 'Channel Images' addon: http://www.devdemon.com/expressionengine-addons/channel-images

# Answer
> 0 votes
You could do this with relationships.

Set up a channel for "Places" with each place having an image and any other info needed.

Then in your event's channel set up a relationship field which maps to the Places channel.

It's much the same as using categories but can sometimes be easier to work with. It's really down to preference as to how you wish to manage the locations.

---
Tags: channel-entries, channel, fields
---


title: Template Routes Error

text:
# Question
Title: Template Routes Error
I have three templates, and three routes in my template group as follows:

* courses -- index (landing page) -- filtered (filtered listing) -- details (course details)

And I want to have the following relevant url structure:

/courses/

/courses/type/undergraduate/

/courses/type/undergraduate/course\_name/

And I have set the following routes:

## template group/template == route

courses/index == nothing in here

courses/filtered == /courses/{filter:alpha\_dash}/{filter2:alpha\_dash}

courses/details == /courses/{filter:alpha\_dash}/{filter2:alpha\_dash}/art/

both 'filtered' and 'details' have segments required.

so.....

**/courses**

gives me courses landing page no probs, I would expect that, reading from the index template as default behaviour.

**/courses/type/undergraduate**

gives me back the filtered course type filtered to 'type', 'undergraduate' which is read from the filtered template.

**/courses/type/undergraduate/art**

gives me back course details for art, reading from the details template, as I expect.

But the problem comes when I put this into my route, adding the course name as the trigger to dynamically shift the the details template as I would expect (as opposed to the hard-coded value 'art'):

*/courses/{filter:alpha\_dash}/{filter2:alpha\_dash}/{coursename:alpha\_dash}*

When I refresh this: **/courses/type/undergraduate/art**

I get the following error, plus my template reverts back the initial landing template of the index in the group.

```
A PHP Error was encountered

```

**Severity: Warning Message: preg\_match\_all(): Compilation failed: group name must start with a non-digit at offset 166 Filename: libraries/Template\_router.php Line Number: 56**

So am I missing the point of routes, or is there some bug in the machine here?

EE version 2.9.0 is the flavour I am playing with.

# Answer
> 1 votes
I was just struggling with this problem, everything I was doing was resulting in the same error. I fortunately just managed to fix it though, problem is I'm not 100% sure why it happened I just know that it did.

Open up the following file: system \> expressionengine \> libraries \> *template\_router* and open up *Route.php*

Find the following line of code: `$hash = md5($variable);` And change it to:

```
$hash = md5($variable);
$hash[0] = 'r';

```

Save and reupload the file.

Link to EllisLab bug

If you then go to *CP \> Home \> Design \> Template Manager \> Template Route Manager* you will see a list of all your templates and routes.

Create all your templates with no forward slash at the beginning (this worked for me but not sure if it's because my site url has a trailing forward slash at the end).

Where you want to have your multiple variable segments use the following;

`courses/type/{type:alpha_dash}/{coursename:alpha_dash}`

And make sure that Segments Required is **unticked!**

Now hit update and you should be good to go.

I've just restructured the answer as I believe this to be the correct path to fixing the issue. The 2nd part is probably still worth doing just for sake of consistency.

---
Tags: routing, template-routes
---


title: Low search pagination not working

text:
# Question
Title: Low search pagination not working
We have the following on our results page:

```
{layout="site/.html-layout"}

{exp:low_search:results
query="{segment_2}"
require_query="yes"
limit="20"
paginate="bottom"
status="not closed"
disable="member_data|category_fields"
}

{if count == 1}
<header class="page-header">
    <h1>
        {if get:collection}
            {if get:collection == "companies"}<a href="{path='companies'}">Company Directory</a> / Company {/if}
            {if get:collection == "dictionary"}<a href="{path='dictionary'}">Dictionary</a> / {/if}
        {/if}
        Search Results {if low_search_keywords} for <mark>“{low_search_keywords}”</mark>{/if} ({if absolute_results != 0}{absolute_results}{if:else}No{/if} result{if absolute_results != 1}s{/if})
    </h1>
</header>

<div class="row">
    <section class="col-md-8 col-md-offset-1 entries_list" style="margin-top: 30px; margin-bottom: 30px;">
        <div class="entries_list">
{/if}

{sn_results_entry_summary}

{if count == total_results}
        </div>
    </section>
</div>
{/if}

{paginate}
{pagination_links}
    <ul class="pagination">
      {first_page}
        <li><a href="{pagination_url}" class="page-first">«</a></li>
      {/first_page}
      {previous_page}
        <li><a href="{pagination_url}" class="page-previous">‹</a></li>
      {/previous_page}
      {page}
        <li{if current_page} class="active"{/if}><a href="{pagination_url}" class="page-{pagination_page_number}">{pagination_page_number}</a></li>
      {/page}
      {next_page}
        <li><a href="{pagination_url}" class="page-next">›</a></li>
      {/next_page}
      {last_page}
        <li><a href="{pagination_url}" class="page-last">»</a></li>
      {/last_page}
      </ul><!-- / .pagination -->
  {/pagination_links}
{/paginate}

{if low_search_no_results}
<header class="page-header">
    <h1>Search Results {if low_search_keywords} for “<mark>  {low_search_keywords}</mark>”{/if} (No results)</h1>
</header>
<div class="bg-warning" style="padding: 20px 20px 10px 20px; ">
    <p>Sorry, there are currently no search results{if low_search_keywords} for “<mark>{low_search_keywords}</mark>”{/if}.</p>
</div>
{/if}<!-- low_search_no_results -->

{/exp:low_search:results}

```

This works fine on the first page, and we get the correct results, with an example URL of :

http://example.com/search/results/?collection=articles|case-studies|guides|products|videos|white-papers|dictionary|companies&keywords=test

When we click a pagination link, we get this URL :

http://example.comsearch/results/P20

Which returns no results.

Oddly on another site, with 90% the same code and no differences in results tags it works as we would expect.

We are running ExpressionEngine v2.8.1 - Build Date: 20140314 and LOW Search 3.1.5

**--- EDIT ---**

We've also tried revising the code so that:

The pagination href changes to: {pagination\_url}{current\_query\_string}

Then a url such as http://example.com/search/results?collection=case-studies|guides|&keywords=test

becomes this when a pagination link clicked: http://example.com//search/results/P2collection=case-studies%7Cguides%7C&keywords=test

Which again fails.

# Answer
Try upgrading Low Search to the latest version. Version 3.1.6 has this bugfix:

> Fixed a bug where a page URL could be falsely rewritten to maintain the query string

...which should probably fix the issue.

If it does not, try changing the hrefs of the pagination links to:

```
href="{pagination_url}?{current_query_string}"

```
> 2 votes

---
Tags: pagination, low-search, low
---


# Question
Title: How to collect convenience fee with Cartthrob, based on total fees
I am utilizing CartThrob to collect invoice payments, since several of my clients have been requesting it. The invoices can be up to $20,000. If my clients want to pay by CC, then I want them to pay the CC charges, loosing $300 on a $10,000 invoice hurts just a little bit. So I am trying to get CartThrob to calculate the convenience fee. I have tried several things…

---

Using CartThrobs shipping function

This works quite well. I can set the shipping fee to be a percentage of the total fees and CartThrob automatically adds it to the total to be processed. But then in the future, if I ever need to charge shipping fees, I can't.

---

Using **add\_to\_cart** function

I began to test this. First I added a product and used the **add\_to\_cart** function to add it to the cart. But parameters from the **add\_to\_cart\_form** such as **allow\_user\_price** and **price** do not work, they don't override the price set in the product entry.

This was quite promising because I would use the **delete\_from\_cart** function just before the **add\_to\_cart** function so I could always reset the price., not in

# Answer
> 0 votes
I see no reason why add\_to\_cart\_form with **allow\_user\_price** and **price** would not work. Could you post the code you have? I use this in many of the products I've created to allow for dynamically created prices. You could try placing a price input field within the form rather than it being a parameter. I have an example of this below where I use it for adding additional charges on a separate page when customers are requested to pay a little more:

```
{exp:cartthrob:add_to_cart_form
    {!-- return="{template_group}/basket" --}

    on_the_fly="y"
    title="Nominal charge"

    tax_exempt="no"
    shipping_exempt="yes"

    allow_user_price="yes"
    allow_user_shipping="no"

    id="charges_form"

}
    <fieldset>
        <p><label>Type:</label>
            <select name="item_options[type]">
                <option value="">-- Select --</option>
                <option value="Additional delivery charge">Additional delivery charge</option>
                <option value="Additional product cost">Additional product cost</option>
                <option value="Other separate payment">Separate payment</option>
                <option value="Returns">Returns</option>
                <option value="Other">Other</option>
            </select>
        </p>
        <p><label>Description:</label> <input name="item_options[description]" value="" class="input" /></p>
        <p><label>Order ref:</label> <input name="item_options[order_ref]" value="" class="input" placeholder="Order number if applicable" /></p>
        <p><label>Amount:</label> <span class="price_field"><span class="prefix">{exp:cartthrob:view_setting prefix="yes"}</span><input name="price" value="" class="input small" /></span> <small>(excl VAT)</small></p>
    </fieldset>
    <input type="submit" value="Add to cart" class="button purple r" />
{/exp:cartthrob:add_to_cart_form}

```

Of course you could place this anywhere, say at the bottom of the cart area before.

I hope this helps

---
Tags: cartthrob
---


# Question
Title: Can EE multiple relationship fields be displayed nested?
Can EE multiple relationship fields be displayed nested? I'm not able to get this working, and it's not clear from the Relationships docs page if it's supposed to.

Say I have 3 channels -- bands, albums and songs -- and my relationship fields are top-down rather than bottom-up, ie, bands have a multiple relationship field of albums, and albums have a multiple relationship field of songs. I want to display a list of bands, and within each band its albums, and within each album its songs. In the following example, songs do not appear:

```
<ul>
    {exp:channel:entries channel="bands"}
    <li>
        {title}
        <ul>
            {bands_albums}
            <li>
                {bands_albums:title}
                <ul>
                    {bands_albums:albums_songs}
                    <li>
                        {bands_albums:albums_songs:title}
                    <li>
                    {/bands_albums:albums_songs}
                </ul>
            </li>
            {/bands_albums}
        </ul>
    </li>
    {/exp:channel:entries}
</ul>

```

I can get a single song from each album to appear by removing the inner loop:

```
<ul>
    {exp:channel:entries channel="bands"}
    <li>
        {title}
        <ul>
            {bands_albums}
            <li>
                {bands_albums:title}
                <ul>
                    <li>
                        {bands_albums:albums_songs:title}
                    <li>
                </ul>
            </li>
            {/bands_albums}
        </ul>
    </li>
    {/exp:channel:entries}
</ul>

```

But I need all the songs.

# Answer
> 1 votes
Off the top of my head, I think I've done this successfully before... Maybe try using the `parents` or `children` tag in conjunction with a `channel` parameter like this:

```
<ul>
  {exp:channel:entries channel="bands"}
   <li>
    {title}
    <ul>
        {bands_albums}
        <li>
            {bands_albums:title}
            <ul>
                {bands_albums:parents channel="songs"}
                  <li>
                     {bands_albums:parents:title}
                  <li>
                {/bands_albums:parents}
            </ul>
        </li>
        {/bands_albums}
    </ul>
   </li>
  {/exp:channel:entries}
</ul>

```

# Answer
> 1 votes
Yes, they should be nestable. I have the following code working - all the relationships are within one channel. I built it as a way to see if relationships could be used intra-channel to build navigation:

```
<h2>The Family Tree from the Top Down </h2>
{exp:channel:entries channel="people" disable="member_data|pagination|categories"}

  {if count==1} {!-- start the top-level unordered list --}
    <ul>
  {/if}

    {parents field="offspring"}
        {if parents:no_results} {!-- entries with no parents are top-level --}
            <li>
              {title}
              {offspring} {!-- second level entries --}

                {if offspring:count == 1}<ul>{/if} {!-- open the second-level unordered list --}

                    <li>
                      {offspring:title}
                      {offspring:offspring} {!-- third level entries --}

                        {if offspring:offspring:count == 1}
                          <ul> {!-- open 3rd level list --}
                        {/if}

                        <li>{offspring:offspring:title}</li>

                        {if offspring:offspring:count==offspring:offspring:total_results}
                          </ul> {!-- close third-level list --}
                        {/if}

                      {/offspring:offspring}
                    </li>

                {if offspring:count==offspring:total_results}
                  </ul> {!-- close second-level list --}
                {/if}

              {/offspring}
            </li>
        {/if}
    {/parents}

    {if count==total_results}
      </ul> {!-- close top-level list --}
    {/if}
{/exp:channel:entries}

```

---
Tags: relationships
---


# Question
Title: Assets field inside of a grid inside of a low variable -- Asset not saving
Having an issue with a low variable of the "Grid" persuasion. I have an assets field inside the grid, and I can upload and add the asset just fine, but when I save the Low Variable, the CP never shows the image inside the field, but only an "Add file" button. I checked the database, and the image name is in the field in the low\_variables\_grid\_field\_12 table.

Assets work in normal entry fields.

Running EE v.2.7.2 Low Variables v.2.4.0 and Assets 2.2.1

Anyone have any wisdom on this issue?

# Answer
Ok after mucking around for a bit I found the combination was

this was what I was trying to no avail.

```
{exp:low_variables:pair var="grid_variable_name" limit="1"}
  {grid_variable_name:grid_assets_field}
    {url}
  {/grid_variable_name:grid_assets_field}
{/exp:low_variables:pair}

```

This worked.

```
{exp:low_variables:pair var="grid_variable_name" limit="1"}
{grid_variable_name:grid_assets_field:url}
{/exp:low_variables:pair}

```

Note the assets field I setup was set to single image only.
> 1 votes

---
Tags: assets, low-variables, grid
---


title: Manipulating data after import

text:
# Question
Title: Manipulating data after import
I'm looking for a way to trigger the hook entry\_submission\_ready on every entry that the Solspace Importer imports. I have another extension that, upon entry\_submission\_ready, manipulates entry data. In this case, the other extension takes a plaintext address, geocodes it, and inserts the geocoded address back into the entry data.

Importer disables extension hook triggers when it imports, and as the comments explain: (../importer/content\_types/importer.content\_type.channel\_entries/content\_type.channel\_entries.php:starting-line 627)

```
// --------------------------------------------
//  Disable Extensions
// - Extension can cause ALL sorts of headaches
// when using the EE Channel Entries API.
// --------------------------------------------

$allow_extensions = ee()->config->item('allow_extensions');

ee()->config->config['allow_extensions'] = 'n';

// -------------------------------------
//  This is a fix for Extensions->active_hook
//  returning boolean true even when extensions
//  are disabled. EE Bug reported.
//  This should be fixed in EE 2.9.1/2.10.0.
// -------------------------------------

$old_ext = ee()->extensions->extensions;

ee()->extensions->extensions = array();

```

The extension triggers cause headaches. And so they do: the geocode extension throws an error if I allow extensions to remain enabled during the import. I could get around this by writing my own extension that is triggered after the importer is completely finished, and having that extension loop over all recently added entries and just triggering the entry\_submission\_ready hook. However, Solspace Importer does not have any (documented or otherwise) hooks for when it's completely finished.

This leaves me with my data imported, but having to go to Edit each individual entry, and just submit an unchanged Edit form so it triggers entry\_submission\_ready and the geocoder extension does it's thing. I'd love a better programmatic way to handle this, as getting the data import for this project right is about 90% of the work (it's a glorified blog project for a client with tons of csv data). Any help or suggestions would be awesome! Thanks!

# Answer
I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on. http://support.solspace.com/support/discussions

If enabling extensions in Importer is then causing issues, it could be that the geocode extension (maybe also others?) doesn't play nice with the native EE Channel Entries API and its hook. It would be worth bringing this up with the extension developer if that's possible. Another idea could be to disable the geocode hook in the exp\_extensions table just for during your import, so that your extension is the only one using the hook (less add-ons using a hook, less problems).
> 0 votes

---
Tags: solspace, solspace-importer
---


# Question
Title: Super Search Plurals and Misspellings Not Working?
On the website http://constructionbook.bnibooks.com/, I'm trying to modify Super Search to get search on the website the way we want it, but I'm having some difficulties.

Super Search Version 2.1.4, Expression Engine Version 2.8.1

We have fuzzy searching turned on with Super Search, and we set search to match plurals and singulars as well as misspelled words. However, it does not appear to be working.

I know that Super Search is supposed to build a database for misspelled words, but when I search for "code book", I get two results on the website. However, when I search "code books", I get zero results.

The parameter search\_word\_within\_words is currently set to "no". Is this affecting how plurals and misspelled words are searched? Otherwise, what could be causing this issue?

EDIT: Here is the {exp:super\_search:results} portion of our search template.

```
    {exp:super_search:results
        channel="products"
        limit="12"
        show_future_entries="yes"
        search_in="title|product_display_title|product_author|product_sku|product_isbn"
        search_words_within_words="yes"
        allow_repeats="no"
        paginate="bottom"
        fuzzy_distance="2"
        fuzzy_weighting="yes"
    }

        {if super_search_no_results}
            <div class="col-md-12">
                <p>No results matched your query.</p>
            </div>
        {/if}

        {if super_search_total_results==1}
            {redirect="product/{url_title}"}
        {/if}

        {if count == 1 OR count == 4 OR count == 7 OR count == 10}

        <div class="ad-col m-bottom">
            <div class="row ">

        {/if}
                <div class="col-md-4 ad-small">
                    <div class="well bg-1 ad-col-height">
                        <h4><a class="inherit-hyperlink" href="{url_title_path=product}">{title}</a></h4>
                        <div class="row m-top">
                            <div class="col-md-4">
                                <a href="{url_title_path=product}"><img class="img-responsive" src="{if product_thumbnail}{product_thumbnail}{if:else}/media/products/noi.jpg{/if}" alt="{title}"></a>
                            </div>
                            <div class="col-md-8">
                                {if product_tag!="" AND product_tag != "None"}
                                    <p class="{product_tag}">{product_tag:label}</p>
                                {/if}
                                {if product_author}<p><small>By {product_author}</small></p>{/if}
                                <p>Product Code: {product_sku}
                                <br />Price: {exp:store:product entry_id="{entry_id}" disable_form="yes" disable_javascript="yes"}{price}{/exp:store:product}
                                <br />{if product_binding != "Other"}{product_binding}{/if}</p>
                                <p><a href="{url_title_path=product}" class="btn btn-default">View Details</a></p>
                            </div>
                        </div><!-- /.row -->
                        <div class="row">
                            <div class="col-md-12 m-top">
                                {product_short_description}
                            </div>
                        </div>
                    </div><!-- /.well -->
                </div><!-- /.ad-small -->

        {if count == 3 OR count == 6 OR count == 9 OR count == 12 OR count == total_results}
            </div><!-- /row -->
        </div>
        {/if}

        {paginate}

        <div class="text-center">
        {pagination_links}
        <ul class="pagination">
        {first_page}
        <li><a href="{pagination_url}" class="page-first">«</a></li>
        {/first_page}

        {previous_page}
        <li><a href="{pagination_url}" class="page-previous"><</a></li>
        {/previous_page}

        {page}
        <li {if current_page}class="active"{/if}><a href="{pagination_url}" class="page-{pagination_page_number} ">{pagination_page_number}</a></li>
        {/page}

        {next_page}
        <li><a href="{pagination_url}" class="page-next">></a></li>
        {/next_page}

        {last_page}
        <li><a href="{pagination_url}" class="page-last">»</a></li>
        {/last_page}
        </ul>
        {/pagination_links}
        </div>

        {/paginate}

    {/exp:super_search:results}

```

# Answer
> 0 votes
Fuzzy searching needs time to "learn" from new words, which means Super Search might not know of all possible fuzzy permutations during the first encounters with the word.

It should be noted that Fuzzy Searching, as cool of a feature as it is, runs on some complex algorithms from a 3rd party library. It's very possible that between that, and the Lexicon taking time to rebuilt itself every once and a while, that you'll experience some inconsistencies over time with the Fuzzy Searching feature.

---
Tags: solspace, search, supersearch
---


title: Solspace Super Search datepicker value

text:
# Question
Title: Solspace Super Search datepicker value
I'm using Solspace Super Search, but wondering if it's possible to change the format for date-searching strings?

It's my understanding that you need to supply date ranges as the following `<input name="event_start_date-from" value="20141113">`, and filtering this way works just fine.

However, as I'm using a datepicker for the user, this isn't a very friendly way to display dates. Instead, it'd be preferable to show as something like the below.

Is this even possible, or maybe I've been going about it the wrong way?

# Answer
> 0 votes
Super Search accepts the YYYYMMDD format, but depending on your datepicker plugin, you might be able to set up the plugin to have a hidden field for the Super Search YYYYMMDD format, and a "dummy" field, visible to users, that would be formatted the way you want.

---
Tags: solspace, search, supersearch
---


# Question
Title: Solspace Super Search only updates values on second page load
Not sure if its simply something I'm doing incorrectly, but following the documentation with the following form:

```
<form method="post" action="{path='events/search_results'}">
    {exp:super_search:search}
    <fieldset>
        <div class="datepicker-container">
            <span class="icon icon-calendar-1"></span>
            <input class="datepicker" type="text" name="event_start_date-from" value="{super_search_event_start_date-from}" />
        </div>

        <div class="datepicker-container">
            <span class="icon icon-calendar-1"></span>
            <input class="datepicker" type="text" name="event_start_date-to" value="{super_search_event_start_date-to}" />
        </div>

        <select class="fancyselect" name="category">
            <option value="">Category</option>
            {exp:channel:categories category_group="6" style="linear"}
                {exp:super_search:variables}
                    {if super_search_category == category_id}
                    <option value="{category_id}" selected="selected">{category_name}</option>
                    {if:else}
                    <option value="{category_id}">{category_name}</option>
                    {/if}
                {/exp:super_search:variables}
            {/exp:channel:categories}
        </select>

        <input type="submit" name="submit" class="button" value="Search" />
    </fieldset>
    {/exp:super_search:search}
</form>

```

The search mechanism works just fine, however on page load it doesn't update each fields' value to reflect what was search. Refreshing the page (or hitting search again) updates this. Not using Ajax or anything, and page reloads fine - the search results are updated properly.

# Answer
> 0 votes
Remove the `{exp:super_search:search}` tag pair from your search form. It's not necessary for the well-functioning of the form.

`{exp:super_search:search}` is typically used as a way to attempt to retrieve previous values, using cookies, in form fields. This can come in handy in some cases when pressing the "Back" button on your browser to return to a form and hoping it's still filled out. On pages where the search form and results are on the same template, for example, this feature can interfere with the parsing of your form values. `{exp:super_search:search}` is also useful if you're using `search_id=""`, which is used along with the Searh History feature.

---
Tags: solspace, search, supersearch
---